Skip to content

Instantly share code, notes, and snippets.

@witkamp
Created August 18, 2010 01:08
Show Gist options
  • Save witkamp/532915 to your computer and use it in GitHub Desktop.
Save witkamp/532915 to your computer and use it in GitHub Desktop.
#!/bin/bash
# This is wrapper for Beyond Compare 3 to be able to do a 3 way and 2 way merge
# When using git though cygwin
# GIT does will pass in a base file name that does not exist when merging two
# files with not common parent. This script detects this and switches to a
# 2-Way merge.
# -Theodore Witkamp theodore.witkamp@gmail.com
##
bc3="`cygpath -u "c:\\Program Files\\Beyond Compare 3\\BComp"`"
echo $bc3
echo "LOCAL $LOCAL"
echo "REMOTE $REMOTE"
echo "BASE $BASE"
echo "MERGED $MERGED"
## Create local var for IF statement
base = $BASE
## GIT will pass in a BASE file name although it only will exist if the file
## has a common base file between the two files
if [ -e $base];
then
echo "3-Way Merge"
exec "$bc3" "$LOCAL" "$REMOTE" "$BASE" "/mergeoutput=$MERGED"
else
## The BASE File does not exist just do a 2-Way merge
echo "2-Way Merge"
exec "$bc3" "$LOCAL" "$REMOTE" "/mergeoutput=$MERGED"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment