0

I have a commit id of "a9a6de2" within my list of commits that's a few versions old.

What's the git command to revert to that commit?

duckmike
  • 1,006
  • 4
  • 16
  • 39
  • Just to be clear: do you mean revert the changes introduced by that commit, or check that commit out? – jub0bs Oct 02 '14 at 14:35
  • possible duplicate of [Revert to a previous Git commit](http://stackoverflow.com/questions/4114095/revert-to-a-previous-git-commit) – Dave Zych Oct 02 '14 at 14:37
  • I want my version of that project to match that previous commit. – duckmike Oct 02 '14 at 14:44

2 Answers2

0

to create a new branch that matches that SHA

git checkout -b YOUR_BRANCH a9a6de2

To make the currently checked out branch match that sha --Not working directory safe --Do not to to push this to a remote server

git reset --hard a9a6de2

Note that git revert does a subtractive patch of the SHA specified (and only the SHA specified), which doesn't sound at all like what you want. I understand this is a common source of confusion for Subversion users because 'revert' behaves differently in Subversion.

Andrew C
  • 13,845
  • 6
  • 50
  • 57
-2

Sounds like you want to revert that commit

$ git revert a9a6de2 should do it

AnkitG
  • 6,438
  • 7
  • 44
  • 72