Last Updated: February 25, 2016
· petersonfs

Use "git revert" rollback a single commit


git revert $SHA1

4 Responses
Add your response

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.

over 1 year ago ·

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.

over 1 year ago ·

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.

over 1 year ago ·

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.

over 1 year ago ·