0 votes
1 view
in DevOps and Agile by (20k 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 (28.4k 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^

Welcome to Intellipaat Community. Get your technical queries answered by top developers !

Categories

...