What does "fatal: You are on a branch yet to be born" mean in this context
I was migrating a svn repo to git. I created a clean temp dir, used git sv开发者_如何学编程n 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
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.
I was having the same error trying to migrate svn to git. Here was my fix.
Confirm you've initialized the git repo:
git init
Confirm you actually had a valid migration from svn:
git branch --remote
#You should see this output:
#git-svn
Create a detached head:
git checkout git-svn
Convert the detached head into the master branch:
git checkout -b master
At this point your git repo will function normally.
精彩评论