Created
November 20, 2012 22:07
-
-
Save bennettmcelwee/4121581 to your computer and use it in GitHub Desktop.
Script for checking in a git revision to SVN
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 | |
# 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