Re: How to not download objects more than needed?

From: Junio C Hamano <>
Date: 2006-02-22 08:32:02
Radoslaw Szkodzinski <> writes:

> I have a pecuilar, but common use case for git.
> I have linux-2.6 repository pulled and I'd like to download some branch
> (say, netdev-2.6), which uses many of the same objects,
> but not to get all the objects from the git server.
> I've already tried certain commands, but still can't do it,
> and my bandwidth isn't too happy about it.
> It seems to require some kind of HEAD rewinding,
> or maybe fetching to another branch, I don't know.
> Anyone cares to help?

It is not peculiar at all.  The tools already should do what you

           o---o---o---...---o (netdev-2.6)
         / < netdev forked some time ago.
    ---o---o---o---o---...---o---o---o (linus tip)
               ^v2.6.16-rc3      ^v2.6.16-rc4 

Suppose the "global" ancestry graph was like the above.  And
netdev-2.6 has not been merged into Linus tree.

What you have, already pulled from Linus, is:

    ---o---o---o---o---...---o---o---o (linus tip)
               ^v2.6.16-rc3      ^v2.6.16-rc4 

And suppose what the netdev tree has is something like this:

           o---o---o---...---o (netdev-2.6)
         / < netdev forked some time ago.

The point being that the netdev tree does not know about Linus
tip you have.

When you "git fetch git://.../netdev-2.6.git/", a program that
runs on your end (git-fetch-pack) and another program that runs
on the other end (git-upload-pack) discuss to find out what both
of you have in common.  Your side starts from Linus tip and go
backwards, telling the other end "I have this, I have that,
...".  At first, netdev side will not see what it knows about,
but after a while, it will see a commit both of you have
(i.e. where the branch forked from).  After they find that out,
your side tells the other side "I want your netdev-2.6 head".

The other side sends the objects needed to complete the chain up
to the requested head, assuming that your side has objects to
complete the common ancestor point (again, the fork point, but
it could be some revs after that if the graph looked like the
above picture).  Objects behind the fork point does not need to
be sent.

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at
Received on Wed Feb 22 08:32:38 2006

This archive was generated by hypermail 2.1.8 : 2006-02-22 08:32:49 EST