diff --git a/020_git-mergetool.sh b/020_git-mergetool.sh index 33f8131..e386a59 100644 --- a/020_git-mergetool.sh +++ b/020_git-mergetool.sh @@ -1,3 +1,70 @@ -git config merge.tool meld -#git config merge.tool gvimdiff3 +BIN_DIR=/usr/local/bin +#BIN_DIR=~/bin + +# Available tools: +git difftool --tool-help + +DIFF_TOOL=meld # graphical diff/merge tool +MERGE_TOOL=meld + + # DIFF_TOOL=vimdiff3 # terminal diff/merge tool + # MERGE_TOOL=vimdiff3 + +# $LOCAL is the file in the current branch (e.g. master). +# $REMOTE is the file in the branch being merged (e.g. branch_name). +# $MERGED is the partially merged file with the merge conflict information in it. +# $BASE is the shared commit ancestor of $LOCAL and $REMOTE, this is to say the file as it was when the branch containing $REMOTE was originally created. + + +git config --global merge.tool ${MERGE_TOOL} +git config --global merge.conflictstyle diff3 +#git config --global mergetool.${MERGE_TOOL}.cmd ${MERGE_TOOL} '$LOCAL $BASE $MERGED' + +git config --global diff.tool ${DIFF_TOOL} +git config --global difftool.prompt false +git config --global alias.d difftool +#git config --global difftool.${DIFF_TOOL}.cmd ${DIFF_TOOL} '$LOCAL $REMOTE' + +git config merge.tool ${MERGE_TOOL} git config merge.conflictstyle diff3 +#git config mergetool.${MERGE_TOOL}.cmd ${MERGE_TOOL} '$LOCAL $BASE $MERGED' + +git config diff.tool ${DIFF_TOOL} +git config difftool.prompt false +git config alias.d difftool +#git config --global difftool.${DIFF_TOOL}.cmd ${DIFF_TOOL} '$LOCAL $REMOTE' + +echo "Global: Active mergetool: $(git config --global merge.tool)" +echo "Global: Merge style: $(git config --global merge.conflictstyle)" + +echo "Global: Active difftool: $(git config --global diff.tool)" +echo "Global: Prompt for difftool: $(git config --global difftool.prompt)" + +echo "Active mergetool: $(git config merge.tool)" +echo "Merge style: $(git config merge.conflictstyle)" + +echo "Active difftool: $(git config diff.tool)" +echo "Prompt for difftool: $(git config difftool.prompt)" + +# to use an unsupported tool see below. +#git config --global diff.external ${BIN_DIR}/git-diff-vimdiff.sh + +# the executable specified by GIT_EXTERNAL_DIFF will be called with a fixed set of 7 arguments: + +# path old-file old-hex old-mode new-file new-hex new-mode + +#cat > ${BIN_DIR}/git-diff-meld.sh <<'EOF' +##!/bin/bash +#echo $* +#meld $2 $5 +#EOF +# +#chmod +x ${BIN_DIR}/git-diff-meld.sh +# +#cat > ${BIN_DIR}/git-diff-vimdiff.sh <<'EOF' +##!/bin/bash +#echo $* +#vimdiff $2 $5 +#EOF +# +#chmod +x ${BIN_DIR}/git-diff-vimdiff.sh