如果您要始終選擇HEAD,那麼您正在尋找名爲ours
的merge strategy
。
做git merge -s ours <branch-to-merge>
報價在合併git的幫助:
合併策略 合併機制(GIT合併和git-pull命令)允許後端的合併策略與-s選項選擇。一些 策略也可以採用自己的選項,可以通過將-X參數傳遞給git-merge和/或git-pull來傳遞。
recursive
This can only resolve two heads using a 3-way merge algorithm. When there is more than one common ancestor that can be used
for 3-way merge, it creates a merged tree of the common ancestors and uses that as the reference tree for the 3-way merge.
This has been reported to result in fewer merge conflicts without causing mis-merges by tests done on actual merge commits
taken from Linux 2.6 kernel development history. Additionally this can detect and handle merges involving renames. This is
the default merge strategy when pulling or merging one branch.
The recursive strategy can take the following options:
ours
This option forces conflicting hunks to be auto-resolved cleanly by favoring our version. Changes from the other tree
that do not conflict with our side are reflected to the merge result.
This should not be confused with the ours merge strategy, which does not even look at what the other tree contains at
all. It discards everything the other tree did, declaring our history contains all that happened in it.
theirs
This is opposite of ours.
ours
This resolves any number of heads, but the resulting tree of the merge is always that of the current branch head,
effectively ignoring all changes from all other branches. It is meant to be used to supersede old development history of
side branches. Note that this is different from the -Xours option to the recursive merge strategy.
這些都是一些上市的策略。 使用git help merge
尋找更多。
你可以使用合併工具 – 2012-07-31 11:12:09
沒有文件需要合併。請再次閱讀該問題。 – rwst 2012-07-31 13:26:20
我在你做出編輯之前已經回答了,並且我建議你再次重新閱讀你的問題'...一個大文件的唯一版本是試圖合併...' – 2012-07-31 13:28:14