6xaz_g
Last Updated: February 25, 2016
·
1.518K
· petersonfs
E9839706f4452e8a3f9cbd89e55ae5e3

Use "git revert" rollback a single commit

Use:

git revert $SHA1

Say Thanks
Respond

4 Responses
Add your response

1716
985347f8d4d896aa17a3984d40971038

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 ·
1720
558240 348768795202901 993864073 n

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 ·
1887
Photo on 08.01.2013 at 04.15

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 ·
1892
E9839706f4452e8a3f9cbd89e55ae5e3

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 ·
Filed Under