Skip to content

Instantly share code, notes, and snippets.

@bennettmcelwee

bennettmcelwee/svnup

Created Nov 20, 2012
Embed
What would you like to do?
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