I’m checked out on feature/my-branch
and running git merge dev
. The conflict markers added to the file are:
<<<<<<< HEAD
let foo = "foo"
let bar = "bar"
||||||| merged common ancestors
let baz = "baz"
let bar = "bar"
=======
let baz = "baz"
let qux = "qux"
>>>>>>> dev
I then run git mergetool
. I have p4mergetool
set as my mergetool and it seems to be working. My .gitconfig
:
[merge]
tool = p4mergetool
conflictstyle = diff3
[mergetool "p4mergetool"]
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge $PWD/$BASE $PWD/$REMOTE $PWD/$LOCAL $PWD/$MERGED
trustExitCode = true
The git mergetool
auto resolves the above conflict (0 conflicts shown in the tool) as:
let foo = "foo"
let qux = "qux"
This sort of makes sense: even though HEAD and dev are in conflict, we can see that one branch updated one line and the other branch updated the other line. So we can probably assume what we want.
My questions are:
- Is there a way to run/configure
git-mergetool
orp4mergetool
specifically to NOT make this assumption and still show a conflict? Do I need to run both commands:
git merge dev git mergetool
to have this conflict solved this automatically? I.e. produce the output:
let foo = "foo" let qux = "qux"
Said another way: is there a git merge strategy/arguments that I can use to simply run the merge
command to produce:
let foo = "foo"
let qux = "qux"