Closed snigdhajain closed 9 years ago
if you want to completely remove the last commit locally .. you can use git reset --hard HEAD~1
To revert a commit, first locate that commit's SHA (eg, abc123
). Then:
git revert <SHA>
Keep in mind: Git will require more information if you're attempting to revert a merge commit, as merge commits have two (or more) parents. If you want to revert a merge, it's usually best to use the Revert
button in the GitHub pull request, as it will revert all the commits in the pull request in one, and you don't need to specify which parent to revert to. (GitHub pull requests know which branches were involved in the original pull request, but Git doesn't actually preserve that information.)
:+1: