Tell me if you recognize this scenario: you’re in the middle of rewriting your local commits when you suddenly realize that you have gone too far and, after one too many rebases, you are left with a history that looks nothing like the way you wanted. No? Well, I certainly do. And when that happens, I wish I could just CTRL+Z my way back to where I started. Of course, it’s never that simple — not even in a GUI.
It was in one of those moments of despair that I finally decided to set out to create my own git undo command. Here’s what I came up with and how I got there.
My story of undoing things in Git starts with the reflog. What’s the reflog, you might ask. Well, I’m here to tell you: every time a branch reference moves Git records its previous value in a sort
Original URL: http://feedproxy.google.com/~r/feedsapi/BwPx/~3/Y0RiG-FIIck/