On Mon, 16 Jan 2017 05:27:41 -0800 (PST)
Ralf Tobel <[email protected]> wrote:

> I have a strange problem when working with bundles.
> 
> I first create a bundle from a repository with tags and branches
> using the following command:
>     git -C <Path To Repo>  bundle create Test.bundle --all
> 
> When I use the follwing command I can see that all the tags and
> branches are showing up in the bundle:
>     git bundle list-heads Test.bundle
> 
> Now I clone the bundle using this command:
>     git clone Test.bundle TestRepo
> 
> When using 'git tag' all the tags are listed as in the list_heads
> above. But when using 'git branch [-r]' none of the branches are
> listed, altough the appear in list_heads.
> 
> It also possible to checkout a tag (of course since they are listed),
> but it's not possible to checkout a branch listed in list-heads.
> 
> Does anybody know what might be the cause of this?

Uh, why do you think cloning a Git bundle is different from cloning
a regular Git repository?  When cloning with default (assumed)
settings, you indeed end up with only a single local branch created.

Let's cite the `git clone` manual:

| DESCRIPTION
|       Clones a repository into a newly created directory, creates
| remote-tracking branches for each branch in the cloned repository
| (visible using git branch -r), and creates and checks out an initial
| branch that is forked from the cloned repository’s currently active
| branch.

I've just git-bundle-d one of my repositories and then cloned it
normally, and `git clone` behaved as documented above.

If you wanted to get a "mirror" of the original repository, it can be
done in several steps by separating initialization of the target
repository and fetching references (heads and tags) into it:

  git init target
  cd target
  git fetch -u path/to/git/bundle 'refs/*:refs/*'
  git reset --hard

The "-u" command-line option to `git fetch` tells it that it's okay to
update the branch named "master" which is currently checked out (even
though it's "unborn" yet), and the so-called "refspec" at the end of
this command tells it to update all the local refs with all the
(matching) remote refs.

The following `git reset --hard` resets the checked out "master" branch
and the index to the tip commit which was fetched for that branch.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to