I am moving from svn to git using git-svn, and some of my branches names started with '-'. Now with help form this question and this migration documentation I am able to pass parameters starting with '-'. but on creating branch git returns an error stating:
fatal: '-CLOSED-mybranch' is not a valid branch name.
git for-each-ref refs/remotes | cut -d / -f 3- | grep -v @ | while read branchname; do git branch -- "$branchname" --"refs/remotes/$branchname"; git branch -r -d -- "$branchname"; done
It doesn't seem you can create a branch which name starts with a dash:
$ git branch "-test" error: unknown switch `e'
It apparently thinks that I'm trying to set the
git branch option
-t, and then gives an error on the following
It also doesn't work with this command:
$ git checkout -b "-test" fatal: '-test' is not a valid branch name.
In this case it actually really says that
-test is not a valid branch name. So it's probably best if you change your branch names so that they won't start with a dash.