Skip to content

Instantly share code, notes, and snippets.

@bennettmcelwee
Created November 20, 2012 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bennettmcelwee/4121581 to your computer and use it in GitHub Desktop.
Save bennettmcelwee/4121581 to your computer and use it in GitHub Desktop.
Script for checking in a git revision to SVN
#!/bin/bash
# Use this with the Git-SVN workflow
# See http://thunderguy.com/semicolon/2012/01/25/a-spoonful-of-git-helps-the-subversion-go-down/
# Use this when getting ready to commit to SVN:
# > git checkout master
# > svnup
# git rebase master yourBranch
branch_name="$(git symbolic-ref HEAD 2>/dev/null)" ||
branch_name="(unnamed branch)" # detached HEAD
branch_name=${branch_name##refs/heads/}
if [ $branch_name != 'master' ]; then
echo "Can only be run from branch \"master\" (not \"$branch_name\")"
exit;
fi;
svn up
svn_revision=`svn info | fgrep 'Revision:' | sed 's/[^0-9]//g'`
git add --all
git commit -m"Update to SVN revision $svn_revision"
git tag svn-$svn_revision
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment