Существуют способы изменить сообщение от более поздних фиксаций:
git commit --amend # for the most recent commit
git rebase --interactive master~2 # but requires *parent*
Как можно изменить сообщение о фиксации самой первой фиксации (который не имеет никакого родителя)?
Предполагая, что у вас есть чистое рабочее дерево, вы можете сделать следующее.
# checkout the root commit
git checkout <sha1-of-root>
# amend the commit
git commit --amend
# rebase all the other commits in master onto the amended root
git rebase --onto HEAD HEAD master
Вы могли бы использовать GIT FILTER-FILINT
:
cd test
git init
touch initial
git add -A
git commit -m "Initial commit"
touch a
git add -A
git commit -m "a"
touch b
git add -A
git commit -m "b"
git log
-->
8e6b49e... b
945e92a... a
72fc158... Initial commit
git filter-branch --msg-filter \
"sed \"s|^Initial commit|New initial commit|g\"" -- --all
git log
-->
c5988ea... b
e0331fd... a
51995f1... New initial commit