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?
views:
110answers:
1
+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
2009-12-13 13:05:22
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
2009-12-14 23:21:35
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
2009-12-15 00:15:31
yeah, you're right, this is actually pretty usable in practice
Martin DeMello
2009-12-16 10:08:10