Git – Edit Last Commit Message

If you have suddenly noticed that the last commit message is unclear or contains some incorrect information – don’t worry, as the most resent commit message can be easily changed if you haven’t yet pushed the commit to a remote server

To edit the last commit message you have to repeat the git commit command with the --amend option.

The most recent commit message can be changed in a text editor or simply through the command-line interface.

Cool Tip: Have mistakenly committed the wrong files? If git push haven’t been done yet – you can rollback the last commit very easy! Read more →

Git – Edit Commit Message

Edit the most recent commit message in the text editor:

$ git commit --amend

Change the last commit message through the command-line:

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