How to automatically resolve a Git conflict by taking the version in the current branch?

You can specify the merge strategy option ours to the recursive (the default) merge strategy. It will do a normal merge, but in case of conflicting hunks will choose the version of the current branch.

git checkout A
git merge -X ours B

Note that this is very different from -s ours, which selects a different merge strategy. Doing so would throw away all changes of the other branch and only keep our version.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)