Skip to content

Instantly share code, notes, and snippets.

@craigw
Created March 11, 2010 10:46
Show Gist options
  • Save craigw/329033 to your computer and use it in GitHub Desktop.
Save craigw/329033 to your computer and use it in GitHub Desktop.
#! /bin/bash
GIT_BRANCH=$1
SVN_BRANCH=`basename $GIT_BRANCH`
git checkout master > /dev/null
git svn branch $SVN_BRANCH > /dev/null
git svn fetch > /dev/null
git branch -r |grep $SVN_BRANCH > /dev/null
if [ "$?" != "0" ]; then
echo "Could not create branch $SVN_BRANCH"
exit 1
fi
git checkout -b tmp/svn-rebase-target $SVN_BRANCH > /dev/null
git rebase --onto tmp/svn-rebase-target master $GIT_BRANCH > /dev/null
git branch -D tmp/svn-rebase-target > /dev/null
git svn dcommit > /dev/null
git svn dcommit -n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment