git change commit message of old commit - How to modify existing, unpushed commit messages?

git commit --amend / git / git-commit / git-rewrite-history / git-amend

I wrote the wrong thing in a commit message.

Baum mit Augen

Answer #1

You can use Git rebasing. For example, if you want to modify back to commit bbc643cd, run

$ git rebase bbc643cd^ --interactive

In the default editor, modify 'pick' to 'edit' in the line whose commit you want to modify. Make your changes and then stage them with

$ git add <filepattern>

Now you can use

$ git commit --amend

to modify the commit, and after that

$ git rebase --continue