-
-
Save abeger/5970676 to your computer and use it in GitHub Desktop.
Wrappers for git svn that stash work before the commands and pop them after:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Little script that stashes outstanding changes, performs an svn dcommit, and pops the stash | |
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 "Committing to svn..." | |
git svn dcommit | |
if [ $git_stashed -eq 1 ] | |
then | |
echo "Retrieving stashed work..." | |
git stash pop | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment