#!/bin/bash # # Check for a merge tool # MERGE_TOOL=`git config --get merge.tool` if [ "$MERGE_TOOL" == "" ]; then echo "I have no merge tool :(" # Tool disclaimer / continue prompt echo " " echo "No merge tool has been set for git. A merge tool would make conflicts easier to resolve." echo "To set a merge tool, see if you have one of the following merge tools installed:" echo " meld opendiff kdiff3 tkdiff xxdiff tortoisemerge gvimdiff diffuse ecmerge p4merge araxis emerge vimdiff " echo "And install thusly (kdiff3 used as example here): " echo " git config --global merge.tool kdiff3" echo " " read -p "Press [Enter] key to continue (ctrl-c to quit).." fi changes=`git status | grep "nothing to commit (working directory clean)"` if [ -z "$changes" ] then git stash save "Saving for pull..." fi git pull --rebase if [ -z "$changes" ] then git stash pop git mergetool fi