1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
#!/bin/bash
# A git pull --rebase which will stash away local changes first, if any
# Author: David Faure <faure@kde.org>
# Adapted to return the correct return value (for the gits script): Marcel Wiesweg <marcel.wiesweg@gmx.de>
# Usage: add this alias in your .gitconfig:
# up = !gitup
# or, if the script is not in your path,
# up = !/path/to/the/script/gitup
ns=`git diff | wc -l`
test $ns -eq 0 && ns=`git diff --cached | wc -l`
test $ns -gt 0 && git stash
git pull --rebase
retval=$?
test $ns -gt 0 && git stash pop --index --quiet
exit $retval
|