tags:

views:

110

answers:

1

I'm using git-svn to work with an svn repository. I have my git master branch tracking svn, and several local git branches. Is there any way to set up things so that if I run git svn rebase or git svn dcommit on a git branch other than master it will simply do nothing?

+2  A: 

Scripting to the rescue!

Create a shell script:

curBranch() {
    r=$(git symbolic-ref HEAD)
    echo ${r##refs/heads/}
}

[ "master" == "$(curBranch)" ] || exit 0

git svn "$@"

and run it with your chosen git-svn subcommand as an argument.

Wojciech Kaczmarek
thanks, that looks neat. was ideally hoping to do this via a git alias, so that i don't have to retrain my finger memory, but the shellscript approach looks handy enough.
Martin DeMello
Yeah welcome to the club. I was looking for some git configuration as yourself, then I discovered I can happily live with a script like this snippet. After all it seems cleaner than manually messing with some .git/ trickery. Happy hacking!
Wojciech Kaczmarek
yeah, you're right, this is actually pretty usable in practice
Martin DeMello