The git merge seems successful but HEAD and the original tags are left in the file


I have configured my git instance to use winmerge as the comparison tool using the following options:

git config --global merge.tool winmerge
git config --replace --global mergetool.winmerge.cmd "\"C:\Program Files (x86)\WinMerge\WinMergeU.exe\" -e -u -dl \"Base\" -dr \"Mine\" \"\$LOCAL\" \"\$REMOTE\""
git config --global mergetool.prompt false

When I run "git mergetool" on a conflicted file I see the winmerge window with the conflicting files and I am able to use winmerge to resolve the conflict as per normal merging.

When I save the file and am prompted by git to answer if the merge was successful I answer "y" and I think I am done.

However when I look at the newly merged file I see the <<<<<<< HEAD and >>>>>>> origin/master marks (these were not in the winmerge window when I saved the final merged file). I also see LOCAL.bak and REMOTE.bak versions of the file in the folder.

I've never had the HEAD and origin markers left in the merged file before nor have I had the LOCAL.bak and REMOTE.bak files left after a merge. It's as if they were added after I answered "y" to the successful merge question since they were not displayed in the winmerge window. Am I missing a configuration option of some sort? I can't seem to find out why it's doing what it's doing.

You've set up the git mergetool wrongly. A working config (posted at for using winmerge as difftool and mergetool is:

    prompt = false
    keepBackup = false
    keepTemporaries = false

    tool = winmerge

[mergetool "winmerge"]
    name = WinMerge
    trustExitCode = true
    cmd = "/c/Program\\ Files\\ \\(x86\\)/WinMerge/WinMergeU.exe" -u -e -dl \"Local\" -dr \"Remote\" $LOCAL $REMOTE $MERGED

    tool = winmerge

[difftool "winmerge"]
    name = WinMerge
    trustExitCode = true
    cmd = "/c/Program\\ Files\\ \\(x86\\)/WinMerge/WinMergeU.exe" -u -e $LOCAL $REMOTE