I keep forgetting how to undo a commit with git because i very rarely need it. But i figured if i aliased it to git undo i wouldn’t need to google the command every time. Now how does one do that? It turned out to be pretty simple actually.
Update: I’ve made an easy extension to git that makes this command more easy to remember, i call it gitUndo. With that extension all you need run is: git undo commit.
The command to undo a commit and reset to the commit before HEAD and keeping the changes is:
And to add this as an alias to the .gitconfig file use this command:
Now when running git undo in the terminal your commit will be reset.