亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

請問在Git中編輯根提交嗎?

請問在Git中編輯根提交嗎?

Git
白衣非少年 2019-08-01 02:01:24
在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



查看完整回答
反對 回復 2019-08-03
?
SMILET

TA貢獻1796條經驗 獲得超4個贊

截至Git版本1.7.12,您現在可以使用

git rebase -i --root


查看完整回答
反對 回復 2019-08-03
?
侃侃爾雅

TA貢獻1801條經驗 獲得超16個贊

擴大ecdpalma的回答,您現在可以使用--root選擇說rebase您希望重寫根/第一次提交:

git rebase --interactive --root

然后根提交將顯示在rebase Todo列表中,您可以選擇編輯或重述它:

reword <root commit sha> <original message>
pick <other commit sha> <message>
...

這是對…的解釋。--root從…Git重基文檔(強調地雷):

重基所有可從<branch>,而不是使用<upstream>這使您可以將根提交重新定位在分支上。.




查看完整回答
反對 回復 2019-08-03
  • 3 回答
  • 0 關注
  • 574 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號