How do I reword the very first git commit message? How do I reword the very first git commit message? git git

How do I reword the very first git commit message?


Do git rebase -i --root

(point to root instead of pointing to a specific commit)

This way, the first commit is also included and you can just reword it like any other commit.

The --root option was introduced in Git v1.7.12 (2012). Before then the only option was to use filter-branch or --amend, which is typically harder to do.

Note: see also this similar question and answer.


You can always use git filter-branch --msg-filter:

git filter-branch --msg-filter \  'test $GIT_COMMIT = '$(git rev-list --reverse master |head -n1)' &&echo "Nice message" || cat' master


pcreux's gist has a good way to reword the first commit:

# You can't use rebase -i here since it takes the parent commit as argument.# You can do the following though:git checkout FIRST_COMMIT_SHA && git commit --amend && git rebase HEAD master