There's ways to change the message from later commits:
git commit --amend # for the most recent commit
git rebase --interactive master~2 # but requires *parent*
How can you change the commit message of the very first commit (which has no parent)?
As of Git version 1.7.12, you may now use
Assuming that you have a clean working tree, you can do the following.
Just to provide an alternative to the higher rated answers:
If you are creating a repo, and know upfront that you'll be rebasing on top of its "first" real commit in the future, you can avoid this problem altogether by making an explicit empty commit at the beginning:
and only then start doing "real" commits. Then you can easily rebase on top of that commit the standard way, for example
git rebase -i HEAD^
You could use
git filter-branch
:To expand on ecdpalma's answer, you can now use the
--root
option to tellrebase
that you want to rewrite the root/first commit:Then the root commit will show up in the rebase TODO list, and you can select to edit or reword it:
This is the explanation of
--root
from the Git rebase docs (emphasis mine):