Monday, October 15, 2012

Undo Git Commit (Un-pushed) And Keep Changes

Git is awesome, as a whole.  There is just that little bit of Git that rears its ugly head every time you make a mistake with your commits.  One little mistake and you see Git's true colours: Git is a Fascist asshole.

But that's not entirely true.  If you're lucky enough to have caught your mistake before pushing your commit to the repo, then Git will graciously spare you with a simple command:
git reset --soft HEAD~1

Your plea before the almighty Git is as follows: "Git, please forgive my impetuous commit but don't punish me with destroying all the changes I planned to commit in the first place."

No comments:

Post a Comment