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

繁星點(diǎn)點(diǎn)滴滴
TA貢獻(xiàn)1803條經(jīng)驗(yàn) 獲得超3個贊
假設(shè)您有一個干凈的工作樹,您可以執(zhí)行以下操作。
# 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

絕地?zé)o雙
TA貢獻(xiàn)1946條經(jīng)驗(yàn) 獲得超4個贊
您現(xiàn)在可以使用--root
選擇說rebase
您希望重寫根/第一次提交:
git?rebase?--interactive?--root
然后根提交將顯示在rebase Todo列表中,您可以選擇編輯或重述它:
reword?<root?commit?sha>?<original?message> pick?<other?commit?sha>?<message> ...
這是對…的解釋。
重基所有可從
<branch>
,而不是使用<upstream>
.?這使您可以將根提交重新定位在分支上。.
- 3 回答
- 0 關(guān)注
- 586 瀏覽
添加回答
舉報
0/150
提交
取消