What does "fatal: You are on a branch yet to be born" mean in this context

Osada Lakmal picture Osada Lakmal · Aug 16, 2011 · Viewed 30.8k times · Source

I was migrating a svn repo to git. I created a clean temp dir, used git svn init to get stuff in there and then added the remote and pushed it. Now on the other actual source dir (which I had cloned from the empty repo before committing stuff from svn) I did a fetch. And then I did a checkout and got above message. After a while I figured that I could get the source with a pull and did that. My question is what did that error message mean in that context ? How did I get that particular error message ? Disclaimer : I am a git newbie

Answer

Andy picture Andy · Aug 16, 2011

I believe it was because your fetch, which only fetches remote refs and commits, didn't give you a local master branch to checkout. Since you were in an empty repo, you were never on a branch, so your git checkout had no master branch to go to.

You could directly checkout the remote master by explicitly naming it with git checkout origin/master but that will leave you in a detached head state.

Once you did the pull, it fetched and merged, the pull created a local master to track the remote master.