I’ve faced strange problem with my git repo. In process of cloning it looses all it’s heads except master. Isn’t head is just a file-reference to the commit id? Or it should be registered somewhere else to be cloned?
It looks exactly as William Pursell described:
cd a
$ git branch
master
* test
$ cd ..
$ git clone a b
Initialized empty Git repository in /private/tmp/b/.git/
$ cd b
$ git branch
* master
Perhaps you haven’t pushed all of your branches to your remote repository. Cloning a remote repository should automatically include all remote branches.
Note that remote branches do not automatically become local branches. You can use the
git branch -acommand to see all the branches you have. Example:With that, we can turn the “next” remote branch into a local one with
git checkout -band specify the remote branch as a starting point:And now you’re all set for working on “next”.