Checking out a git branch with an ambiguous name

So you have tags and branches with the same name in git. Possibly because you just ran svn2git on a massive repo. Normally you wouldn’t create this situation intentionally. Apparently you can use something like --prefix=svn/ to get around this problem when using git-svn, and possibly on import.

After the fact though, here are some tips. So you have a tag and a branch named my-ambiguous-name

git checkout my-ambiguous-name seems to preference the tag of that name. If you want the branch, here’s how to do it:

git checkout --track -b my-ambiguous-name_b origin/my-ambiguous-name

Notice that for the local name I affixed ‘_b’.

Then you can git pull, and git checkout my-ambiguous-name_b and it will work.

One comment on “Checking out a git branch with an ambiguous name

  1. Solved my problem in a minute, after trying to figure it out by myself somewhat more than half an hour.

Leave a Reply

Your email address will not be published. Required fields are marked *