Every once in a while I figure a typo as I am hitting git commit
. Mind you, it's not that I am making a typo once in a while - I do typos all the time - I only notice them once in a while. :)
What follows is a common pair of commands:
$ git reset --soft HEAD~
$ git commit -m"Corrected spelling."
As I did with other git operations I do often enough, I decided to make it an alias:
$ git config --global alias.redo '!git reset --soft HEAD~ && git commit'
Now I can use a single git command to do correction:
$ git redo -m"Corrected spelling."
Even better, if comment is not given, command will simply move the latest commit back into the staging area.
Might not be a huge change but it does make a common operation faster.