I configured git to use SmartSynchronize as the merge tool but when I run git mergetool
I still see the conflict markers, like this:
I was using P4Merge and saw that it handles these conflict markers, but I really like viewing the merged file in the middle of the screen like in SmartSynchronize; so am I doing something wrong or is this tool just unable to handle conflict markers?
My .gitconfig
:
[mergetool "smartsynchronize"]
cmd = '/C/Program Files (x86)/SmartSynchronize 3.3/bin/smartsynchronize.exe' "$LOCAL" "$REMOTE" "$MERGED"
(also, if you know a way to make P4Merge show the merged file in the middle like that, I'd love to know)
git-mergetool
invokes a three-way merge tool - that is, a tool that produces a merge result from two branches and the common ancestor. There are four files in all - three input files and an output file.However, you are invoking the
mergetool
with only three inputs: the two branches and the merge result. Thus, it is using the merge result as the common ancestor - the file thatgit-merge
has written the merge file (with conflict markers). Instead, you need to invoke your merge tool with the two sides ($LOCAL
,$REMOTE
) and the common ancestor$BASE
, telling it to place the merge result into$MERGED
.Your 3-way merge tool should be capable of actually distinguishing between the common ancestor and the output file. You should talk to your tool's author to determine if this is true and suggest to them that their tool is deficient if they cannot.
If you really love your deficient merge tool, however, you can create a script that:
$BASE
to a temporary file$LOCAL
,$REMOTE
and the temporary file$MERGED