My favourite command, 'git up': (save as git-up somewhere in your
PATH):
#!/bin/sh
no_changes () {
git diff-index --quiet --cached HEAD --ignore-submodules -- &&
git diff-files --quiet --ignore-submodules
}
git update-index -q --refresh
POP=1
if no_changes ; then
POP=0
else
echo "Saving local modifications"
git stash
POP=1
fi
echo ""
echo "Updating from remote server"
if git pull --rebase "$@" ; then
echo ""
git log --stat h...@{1}..head@{0}
echo ""
fi
if [ $POP = 1 ] ; then
echo ""
echo "Restoring stashed local modifications"
git stash pop
fi