Skip to content

Instantly share code, notes, and snippets.

@ymendel
Created February 4, 2009 00:37
Show Gist options
  • Save ymendel/57853 to your computer and use it in GitHub Desktop.
Save ymendel/57853 to your computer and use it in GitHub Desktop.
#!/bin/sh
BRANCHES=`git branch`
if [ $? != 0 ]; then
exit
fi
GIT_SVN=0
git branch -r | grep 'git-svn' > /dev/null
if [ $? = 0 ]; then
GIT_SVN=1
fi
MAIN=${1:-master}
CURRENT=`git branch | awk '/^\* /{print $2}'`
set -x
git checkout ${MAIN}
if [ $GIT_SVN = 1 ]; then
git svn rebase
else
git pull origin ${MAIN}
fi
git checkout ${CURRENT}
git rebase ${MAIN}
#!/bin/sh
BRANCHES=`git branch`
if [ $? != 0 ]; then
exit
fi
GIT_SVN=0
git branch -r | grep 'git-svn' > /dev/null
if [ $? = 0 ]; then
GIT_SVN=1
fi
MERGE=''
while getopts 'm' OPT; do
if [ $OPT = 'm' ]; then
MERGE='--no-ff'
shift
fi
done
MAIN=${1:-master}
CURRENT=`git branch | awk '/^\* /{print $2}'`
set -x
if [ $GIT_SVN = 1 ]; then
git svn dcommit
git checkout ${MAIN}
git svn rebase
git checkout ${CURRENT}
else
git checkout ${MAIN}
git merge ${CURRENT} ${MERGE}
git push origin ${MAIN}
git checkout ${CURRENT}
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment