Skip to content

Instantly share code, notes, and snippets.

@DennisOSRM
Created April 24, 2014 08:59
Show Gist options
  • Save DennisOSRM/11247276 to your computer and use it in GitHub Desktop.
Save DennisOSRM/11247276 to your computer and use it in GitHub Desktop.
bashrc bit to start mergetool on conflict automatically
git()
{
if [[ $1 == "merge" ]] || [[ $1 == "rebase" ]] || [[ $1 == "pull" ]]; then
command git "$@"
rc=$?
if [[ $rc == 1 ]]; then
echo "There are conflicts, better run git-mergetool!!!"
# There might be some other condition that returns a '1',
# if so you can add another check like this:
# if grep Conflicts $(git --git-dir)/MERGE_MSG;
command git mergetool
fi
else
command git "$@"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment