3 回答

TA貢獻(xiàn)1804條經(jīng)驗(yàn) 獲得超7個(gè)贊
您可以使用遞歸“他們的”策略選項(xiàng):
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.
注意:正如手冊(cè)頁(yè)所述,“我們的”合并策略選項(xiàng)與“他們的”合并策略非常不同。

TA貢獻(xiàn)1876條經(jīng)驗(yàn) 獲得超6個(gè)贊
git pull -s recursive -X theirs <remoterepo or other repo>
或者,簡(jiǎn)單地,對(duì)于默認(rèn)存儲(chǔ)庫(kù):
git pull -X theirs
如果您已經(jīng)處于沖突狀態(tài)...
git checkout --theirs path/to/file

TA貢獻(xiàn)2036條經(jīng)驗(yàn) 獲得超8個(gè)贊
如果您已經(jīng)處于沖突狀態(tài),并且只想接受他們所有的狀態(tài):
git checkout --theirs .
git add .
如果要執(zhí)行相反的操作:
git checkout --ours .
git add .
這太劇烈了,因此請(qǐng)確保您確實(shí)要在執(zhí)行此操作之前先將所有內(nèi)容清除掉。
- 3 回答
- 0 關(guān)注
- 557 瀏覽
添加回答
舉報(bào)