Use "git revert" rollback a single commit
Use:
git revert $SHA1
Written by Peterson Ferreira
Related protips
4 Responses
Be aware: git revert
is actually creating a new commit containing the reverse version of the patch resulting from the commit to revert. This may result in conflicts depending how far away the commit in question is from your current HEAD and what changed since then! git revert
is not aware of changes between that commit and HEAD.
I prefer to do a git rebase -i $SHA1 and choose what to keep and what to discard. Unfortunately this means you have to do a git push -f and it's not always a good thing.
To commit changes again you have to revert the revert commit.
Also, you can revert whole feature if it was merged with --no-ff flag. Just revert the merge commit and you're done.
It's really guys! In my single case i need to be taken specific commit. Not necessary the last. This is the way i can do that.