Problem with git + DiffMerge on OS X

I configured SourceGear DiffMerge as my default git merge tool using the following instructions:

git config --global diff.tool diffmerge git config --global difftool.diffmerge.cmd "diffmerge \"\$LOCAL\" \"\$REMOTE\"" git config --global merge.tool diffmerge git config --global mergetool.diffmerge.cmd "diffmerge --merge --result=\"\$MERGED\" \"\$LOCAL\" \"\$BASE\" \"\$REMOTE\"" git config --global mergetool.diffmerge.trustexitcode false 

Source: http://www.andrejkoelewijn.com/wp/2010/01/08/configure-diffmerge-with-git/

However, when I run git mergetool , I get the following error:

Diffiff error

What could be causing this problem?

+8
git diffmerge macos
source share
1 answer

There may not be a $BASE file if, for example, the two files to be merged do not have a common ancestor, or if you encounter a conflict when applying or reinstalling the patch, and not in merging branches. In this case, as long as the $BASE variable is set anyway, there will be no file there.

In your mergetool command, you need to check if $BASE exists, and merge without a common ancestor if that is not the case. This is not like DiffMerge supports this mode (it supports combining two files without a common ancestor, but it always writes the output to one of the files, not to the result file). Instead, you will need to pass $LOCAL as a $BASE file if $BASE does not exist:

 git config --global mergetool.diffmerge.cmd 'diffmerge --merge --result="$MERGED" "$LOCAL" "$(if test -f "$BASE"; then echo "$BASE"; else echo "$LOCAL"; fi)" "$REMOTE"' 
+8
source share

Source: https://habr.com/ru/post/650121/


All Articles