[英]How do I accept git merge conflicts from “their” branch for only a certain directory?
[英]During git merge, in the case of merge conflict, how do I accept all changes from a certain branch?
我有兩個分支: cat
與dog
。 他們的歷史有所不同。
我想將dog
合並成cat
。 在這個合並中,我如何自動接受所有文件的dog
版本,而不是必須解決與git add/rm
的合並並重復提交?
同樣,我如何接受所有文件的cat
版本?
在將dog
合並到cat
時接受所有dog
版本:
$ git checkout cat
$ git merge -s recursive -X theirs dog
在將dog
合並到cat
時接受所有cat
版本:
$ git checkout cat
$ git merge -s recursive -X ours dog
-X
指定-s
指定的策略的選項。 Git合並相對於當前檢出的分支進行,因此theirs
和ours
的相對於當前檢出的分支。
遞歸策略通常是默認策略,因此您可能不必使用-s
。
記錄在git-merge(1) 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.