-
-
Save RonnyPfannschmidt/5661042 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# A hacky command for a common task: | |
# - stash away all changes in working branch | |
# - update master from SVN | |
# - rebase working branch on master | |
# - flush all committed changes from working branch to master | |
# - push them to SVN | |
# - update working branch again | |
# - patch in changes | |
WORKING_BRANCH=`git rev-parse --abbrev-ref --symbolic HEAD` | |
if [ "$WORKING_BRANCH" = "master" ]; | |
then | |
echo "Already on master."; | |
exit 1; | |
fi; | |
function step { | |
echo git "$@" | |
git "$@" | |
state=$? | |
if [ $state -ne 0 ]; | |
then | |
echo "Aborting [$state]."; | |
exit 1; | |
fi; | |
} | |
step stash | |
step checkout master | |
step svn rebase | |
step checkout $WORKING_BRANCH | |
step rebase master | |
step checkout master | |
step pull . $WORKING_BRANCH | |
step svn dcommit | |
step checkout $WORKING_BRANCH | |
step rebase master | |
git stash pop | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment