Fix git commit message

I often forget to mention issues or documentation in commit messages, how to fix them?

To fix the latest commit message run

$ git commit --amend

edit and save the buffer. Done.

Want to edit an old commit message?

If you find a mistake in an older commit, but still one that you have not yet published to the world, you use git rebase in interactive mode, with git rebase -i marking the change that requires correction with edit.

Resources:

Stackoverflow - How do I edit an incorrect commit message in git?
Git Community Book - Undoing in Git - Reset, Checkout and Revert

blog comments powered by Disqus