# Little script that stashes outstanding changes, performs an svn rebase, and pops the stash # gsu -f will also perform an svn fetch to get new branches perform_fetch=0 while getopts ":f" opt do case $opt in f) perform_fetch=1 ;; \?) echo "Invalid option: -$OPTARG" >&2 ;; esac done git_stashed=0 git diff-index --quiet HEAD > /dev/null if [ $? -eq 1 ] then echo "Stashing current work..." git stash git_stashed=1 fi echo "Getting latest from svn..." git svn rebase if [ $perform_fetch -eq 1 ] then echo "Fetching latest branches and tags..." git svn fetch fi if [ $git_stashed -eq 1 ] then echo "Retrieving stashed work..." git stash pop fi