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"'
Brian campbell
source share