Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in DevOps and Agile by (19.4k points)

There are 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)?

1 Answer

0 votes
by (27.5k points)

Let us say, you are creating a repo, and you are already aware of the face that you'd have to perform 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:

git commit --allow-empty -m "Initial commit"

Now start doing "real" commits. Once done, you can easily rebase on top of that commit the standard way, for example git rebase -i HEAD^

Browse Categories

...