anonymoussc
Jun 12, 2016 • Less than a minute read

Amending the most recent git commit message.

Amending the most recent git commit message.

# Will open your editor, allowing to change the commit message of the most recent commit.
git commit --amend

Amending the most recent git commit message (direct).

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

Changing the message of a commit that already being pushed to a remote branch.

git push <remote> <branch> --force

# Or

git push <remote> <branch> -f

Use interactive rebase.

# N is the number of commits to the last commit you want to be able to edit
git rebase -i HEAD~N

Reference :

  1. Edit an incorrect commit message in Git

  2. git-commit(1) Manual Page

Post by: Anonymoussc (@anonymoussc)