74 lines
2.3 KiB
Bash
Executable File
74 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
BIN_DIR=/usr/local/bin
|
|
#BIN_DIR=~/bin
|
|
|
|
apt-get -y install meld
|
|
|
|
# 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
|