8

I do this:

$ git svn clone http://monsterdebugger.googlecode.com/svn/ -s --prefix=svn/ monsterdebugger
$ cd monsterdebugger
$ git branch -a
* master
  remotes/svn/trunk
$ git co remotes/svn/trunk
Note: checking out 'remotes/svn/trunk'.

You are in 'detached HEAD' state. <And so on...>

I guess I'm not fully understanding what's going on under the hood here. Shouldn't remotes/svn/trunk be a tracking branch against the svn repo? Why did I end up with a detached head?

Tim Keating
  • 6,443
  • 4
  • 47
  • 53
  • Isn't `master` your tracking branch? Why do you want to check out the remote branch? Anyway, I think your question is a duplicate of this one: http://stackoverflow.com/questions/3965676/why-did-git-detach-my-head. In essence, any time you check out a branch that's not "yours" (like a remote branch), you get a detached HEAD. – Carl Norum Jan 04 '12 at 22:58
  • *Is* master my tracking branch? That's a fascinating question! It's not QUITE a dupe question because it's specifically about git-svn, although that probably doesn't make as much of a difference as I'm concerned it does. – Tim Keating Jan 06 '12 at 04:15
  • yes, it probably is. Check out `master` and do `git svn dcommit --dry-run` and see what it tells you. – Carl Norum Jan 06 '12 at 18:56

1 Answers1

10

It's because it's a remote branch. You need to create a local branch for it, with something like:

git checkout -b my-trunk remotes/svn/trunk
Karl Bielefeldt
  • 47,314
  • 10
  • 60
  • 94