#!/bin/sh cd "$(dirname "$0")" if [ "$(git ls-files -md)" ]; then updated=true git stash -qelse updated=falsefi echo "== $PWD =="git pull -q --rebase if $updated; then git stash pop -qfi [ $# -eq 0 ] || exec "$@"
#!/bin/sh
cd "$(dirname "$0")"
if [ "$(git ls-files -md)" ]; then
updated=true
git stash -q
else
updated=false
fi
echo "== $PWD =="
git pull -q --rebase
if $updated; then
git stash pop -q
[ $# -eq 0 ] || exec "$@"