[英]Git merge --theirs ALL files EXCEPT the ones that have been edited by <name>, <name>, or <name>, in which case I'll fix merge conflicts myself?
我有兩個分支,主分支和上游分支,具有成千上萬個要合並的文件和相等數量的合並沖突。
事實是,上游(“他們的”)文件的90%是我要保留的文件。 除了“ git mergetool”全部使用之外,還有一種方法可以自動使用所有上游文件,除非文件已由特定人員編輯過? 這樣,我可以自己僅用十幾個文件來解決合並沖突。
我認為這是偽代碼的工作方式:
git checkout master
git merge upstream --squash --all-of-theirs-except firstguy@mail.com secondguy@mail.com
git mergetool //For the remaining conflicts
git push origin master
在執行git mergetool
之前,您可以從上游檢出文件。 然后,您可以使用git mergetool
解決其余文件的沖突。
git merge upstream squash
git checkout upstream -- <files that you want as "theirs">
git mergetool //Resolve the remaining conflicts.
要獲取文件列表,可以使用git log --author=<email> --name-only --oneline
並解析輸出以獲取列表。 或者您可以執行git checkout -- path/to/a/directory/
從特定目錄中簽出所有文件,而不必單獨指定所有文件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.