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.
注意:正如手冊頁所述,“我們的”合并策略選項與“他們的”合并策略非常不同。

TA貢獻1876條經驗 獲得超6個贊
git pull -s recursive -X theirs <remoterepo or other repo>
或者,簡單地,對于默認存儲庫:
git pull -X theirs
如果您已經處于沖突狀態...
git checkout --theirs path/to/file

TA貢獻2036條經驗 獲得超8個贊
如果您已經處于沖突狀態,并且只想接受他們所有的狀態:
git checkout --theirs .
git add .
如果要執行相反的操作:
git checkout --ours .
git add .
這太劇烈了,因此請確保您確實要在執行此操作之前先將所有內容清除掉。
- 3 回答
- 0 關注
- 548 瀏覽
添加回答
舉報