Whoops, I made a typo in my commit message

Published 02 April 2020 18:20

Just a reminder for myself. Fix your commit messages if they contain misspelled words...

git commit --amend -m "New commit message."

Dries Vints (who's part of the official Laravel team) tweeted a short video about commit messages from people and how they react to it. Frank de Jonge (known from flysystem & Mollie Payments) replied to the tweet with a simple trick to fix the last commit message.

Replace the tip of the current branch by creating a new commit. The recorded tree is prepared as usual (including the effect of the -i and -o options and explicit pathspec), and the message from the original commit is used as the starting point, instead of an empty message, when no other message is specified from the command line via options such as -m, -F, -c, etc. The new commit has the same parents and author as the current one (the --reset-author option can countermand this).

More information can be found on git-scm.com

Robin Dirksen

Robin Dirksen

On my blog, you can find articles that I've found useful or wanted to share with anyone else.

If you want to know more about this article or just want to talk to me, don't hesitate to reach out.