1

I'm not very familiar with git but have been playing around with it so that I can learn by doing. I searched the user manuals and stackoverflow but not sure if it has the answer I'm looking for.

I made a few commits and all went well. Then I accidentally (still not sure how) did a revert on some change that I wanted to keep and I want to know how to undo that revert.

This is my git reflog:

60e7a2d HEAD@{10}: checkout: moving from master to production 
246007f HEAD@{11}: pull origin master: Merge made by the 'recursive' strategy.
079b2e3 HEAD@{12}: revert: Revert "added dropdown to the about menu for #faq"

I want to undo whatever I did wrong at HEAD@{12} because it removed the change (added dropdown to about menu) which I actually want to keep.

GK79
  • 241
  • 1
  • 4
  • 17
  • 1
    Nope, different. That question is wrongly titled if you read the actual discussion there. – GK79 Jun 17 '15 at 14:59
  • 2
    In that case, please explain how your question is different from the question I linked to. It's not obvious to me. – jub0bs Jun 17 '15 at 15:01
  • Apologies, the answers for that question also worked for me. i thought mine was different because i had subsequently made other changes but that's not a big deal for git. you can revert any isolated commit anytime, apparently. as mentioned, am not very good at git yet. thanks! – GK79 Jun 20 '15 at 17:27

1 Answers1

6

Just look in the log for the commit with the comment 'Revert "added dropdown to the about menu for #faq"'. Assuming the hash of that commit is ABC, do git revert ABC. This will revert the revert.

David Deutsch
  • 17,443
  • 4
  • 47
  • 54