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

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

解決Git合并沖突以利于拉動期間的更改

解決Git合并沖突以利于拉動期間的更改

Git
HUH函數 2019-10-23 15:18:02
我該如何解決git merge沖突以利于更改?基本上,我需要從工作樹中刪除所有有沖突的更改,而不必git mergetool在保持所有無沖突更改的同時進行所有沖突。最好在拉動時這樣做,而不是在之后。
查看完整描述

3 回答

?
三國紛爭

TA貢獻1804條經驗 獲得超7個贊

您可以使用遞歸“他們的”策略選項:


git merge --strategy-option theirs


從男人:


ours

    This option forces conflicting hunks to be auto-resolved cleanly by 

    favoring our version. Changes from the other tree that do not 

    conflict with our side are reflected to the merge result.


    This should not be confused with the ours merge strategy, which does 

    not even look at what the other tree contains at all. It discards 

    everything the other tree did, declaring our history contains all that

    happened in it.


theirs

    This is opposite of ours.

注意:正如手冊頁所述,“我們的”合并策略選項與“他們的”合并策略非常不同。


查看完整回答
反對 回復 2019-10-23
?
HUX布斯

TA貢獻1876條經驗 獲得超6個贊

git pull -s recursive -X theirs <remoterepo or other repo>

或者,簡單地,對于默認存儲庫:


git pull -X theirs

如果您已經處于沖突狀態...


git checkout --theirs path/to/file


查看完整回答
反對 回復 2019-10-23
?
慕桂英3389331

TA貢獻2036條經驗 獲得超8個贊

如果您已經處于沖突狀態,并且只想接受他們所有的狀態:


git checkout --theirs .

git add .

如果要執行相反的操作:


git checkout --ours .

git add .

這太劇烈了,因此請確保您確實要在執行此操作之前先將所有內容清除掉。


查看完整回答
反對 回復 2019-10-23
  • 3 回答
  • 0 關注
  • 548 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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