6
在合併衝突中,我試圖解決所有合併衝突,以支持特定分支。git:致命:'--ours/- 他們'不能用於轉換分支
我試圖做git checkout --ours
,但我得到了以下錯誤:
fatal: '--ours/--theirs' cannot be used with switching branches
我如何能實現我想要做什麼?
在合併衝突中,我試圖解決所有合併衝突,以支持特定分支。git:致命:'--ours/- 他們'不能用於轉換分支
我試圖做git checkout --ours
,但我得到了以下錯誤:
fatal: '--ours/--theirs' cannot be used with switching branches
我如何能實現我想要做什麼?
使用git checkout
與--ours
或--theirs
需要至少一個參數:要檢出的文件/目錄的路徑。
由於the manual說:
When checking out paths from the index, check out stage #2 (ours) or #3 (theirs) for unmerged paths.
所以:
git checkout --ours <path(s)>
有趣的是,在隱身瀏覽器,谷歌只看到這整個錯誤字符串的單個時間:在[這個答案]發表評論(http://stackoverflow.com/a/28782831/5353461)。如果沒有'致命'的序言,它會增加5倍。爲什麼不在源代碼中拾取我想知道的字符串? –
因爲它不是單個字符串:https://github.com/git/git/git/blob/master/builtin/checkout.c#L1085-L1086 – torek
git checkout --ours將無法使用分支名稱。問題是如何切換到一個分支,自動解決與-ours策略的合併衝突 –
electrodrel