在Git中編輯根提交嗎?有一些方法可以更改以后提交的消息:git commit --amend # for the most recent commit
git rebase --interactive master~2 # but requires *parent*如何更改第一次提交(它沒有父級)的提交消息?
3 回答

繁星點點滴滴
TA貢獻1803條經驗 獲得超3個贊
假設您有一個干凈的工作樹,您可以執行以下操作。
# 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

侃侃爾雅
TA貢獻1801條經驗 獲得超16個贊
--root
rebase
git rebase --interactive --root
reword <root commit sha> <original message> pick <other commit sha> <message> ...
--root
重基所有可從 <branch>
,而不是使用 <upstream>
. 這使您可以將根提交重新定位在分支上。.
- 3 回答
- 0 關注
- 574 瀏覽
添加回答
舉報
0/150
提交
取消