0
我有兩個分支在mercurial A和B,他們都有tests.py
文件,但我不想在合併A和B時合併這些文件。如何僅忽略tests.py
並自動合併其他所有內容?如何在mercurial中部分合並分支?
我有兩個分支在mercurial A和B,他們都有tests.py
文件,但我不想在合併A和B時合併這些文件。如何僅忽略tests.py
並自動合併其他所有內容?如何在mercurial中部分合並分支?
我不認爲有一種方法可以在合併時簡單地「忽略」對文件的更改。你可以做的是選擇你想要進入合併變更集的哪個版本的tests.py
(來自分支A或B的版本)並使用它。
由於hg merge
離開引起了你的工作副本合併兩個分支,給你一個機會來修復衝突,等等,你可以在工作副本恢復tests.py
你犯哪個版本,你想之前的變化保持。這裏有一個例子:
$ hg update A # switch to branch A
$ hg merge B # merge w/ branch B
...
$ hg status
M tests.py
M some_other_file
...
# reset tests.py to version from either branch A or B.
# Let's pick A since that was our original parent.
$ hg revert -r A tests.py
$ hg commit
注意hg merge B
可能會產生衝突tests.py
,所以如果你使用hg revert -r A tests.py
你想也需要標註衝突與hg resolve -m tests.py
得到解決。