Last active
September 27, 2023 07:39
-
-
Save elsevers/11349227 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Wrapper script for git mergetool | |
# This requires the .gitconfig file to have: | |
# - mergetool entry for "wdiff"; | |
# - mergetool entry for "fw_def"; | |
# These merge tool entries must both specify the | |
# cmd field. The command to call this script: | |
# [mergetool "merge_wrapper"] | |
# cmd = $HOME/merge-wrapper \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\" | |
# Locate this script in your $HOME | |
BASE=$1 | |
LOCAL=$2 | |
REMOTE=$3 | |
MERGED=$4 | |
WDIFF="\.doc" | |
if echo "$BASE" | grep -q "$WDIFF"; then | |
echo "Using merge tool for word file"; | |
CMD=$(git config mergetool.wdiff.cmd) | |
eval $CMD | |
else | |
#checking for additional special merge tool cases | |
#Finally, the default case: | |
echo "Using default merge tool"; | |
CMD=$(git config mergetool.fw_def.cmd) | |
eval $CMD | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment