how to undo a commit from remote 1

how to undo a commit from remote

git reset --hard HEAD~3
git push -f

Here is what the above code is Doing:
1. git reset –hard HEAD~3
This will reset the current branch to the state it was in 3 commits ago.
The –hard flag will discard any uncommitted changes in your working tree.
2. git push -f
This will force push the changes to the remote repository.
The -f flag will overwrite the remote repository with the state of your local repository.

Similar Posts