Git: How To Edit A Commit Message


Wrote the wrong thing in your commit message?

If you need to make multi line changes its better to use this command because it will open the editor:

    git commit --amend

For a quick edit its easier to use the -m flag:

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

Careful with any staged changes you have, they will be committed when you amend your commit.

If you need to edit the message of a commit already in your remote branch, you'll have to force push your changes.

    git push <remote> <branch> -f
Archive