2011年4月13日 星期三

merge -- just use the target file

merge 得時候 會自動修改 conflict 的 file,並且在 file 裡面 conflict 的地方加上:
>>> HEAD
=====
..

的 mark。

要是merge 時,只是要用 另一個 branch 的 code,並不是真的要 加上 local 跟 branch 的 code。
可以在 merge command 完,再用:
$git checkout --theirs .
$git add -u
$git commit

把 "theirs" 的 code 都checkout 出來 (最後的 '.' 代表全部的 code)
把所有conflict 的 file 都mark 為 resolve (-u)
然後 commit (會自動加上 merge 的 comment

如果是要用原來的 (那 merge 幹麼?) , checkout 時用 option --ours


ref :

沒有留言:

張貼留言