Git: Changing commit messages

Updated . Posted . Visible to the public.

To change the commit message of the latest (unpushed, unmerged) commit, you can use
git commit --amend

To change the commit message of an earlier (unpushed, unmerged) commit [COMMIT], you can do
git rebase -i COMMIT~

For a current version of git, you can simply mark the line with "reword", and git will ask you later for the new message.

For older versions:

  • mark the line with edit
  • save the file
  • do a git commit --amend when rebasing stops at the relevant commit
  • git rebase --continue
Profile picture of Tobias Kraze
Tobias Kraze
Last edit
Keywords
rename
License
Source code in this card is licensed under the MIT License.
Posted by Tobias Kraze to makandra dev (2010-12-06 11:24)