git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Apply git bundle to source tree?

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 18, 2020, 15:41 UTC
Message-ID
<xmqqbli3nlda.fsf@gitster.c.googlers.com>
In-Reply-To
<CAHpGcMJqmUmCR_u3fxSVppzwBo8_6RJG5-WLrXAWXm+OQ6_3bA@mail.gmail.com>
Andreas Grünbacher <andreas.gruenbacher@gmail.com> writes:
Show 10 quoted lines
> I'm wondering if there's a way to apply a particular head in a bundle
> to a source tree, for example:
>
>   $ git bundle create v5.9-rc1.bundle v5.8..v5.9-rc1
>   $ cd linux-5.8
>   $ git bundle APPLY ../5.9-rc1.bundle v5.9-rc1
>
> That would allow to reconstruct either the original repository or just
> the underlying source tree, so the bundle could be used as a kind of
> super diff.
There seem to be a bit of misconception.

Do not think that a bundle is like a patch. When you created the bundle in the above example, you did not create a "super diff" between v5.8 and v5.9-rc1 that you can apply to a working tree files that correspond to v5.8 release. That is not what you did.

What you created is an equivalent of a (shallow) repository, that contains everything needed to get v5.9-rc1 by those who have a Git repository that has v5.8 to fetch/pull from. It is OK to have more, but you MUST have v5.8 for the bundle in the example to be usable.

So assuming that your 'linux-5.8' is not just a tarball extract but a Linux repository with v5.8 tag in it (i.e. "git log v5.8" gives you sensible output) then the command to use is not apply but fetch, e.g.

    $ git bundle fetch ../5.9-rc1.bundle v5.9-rc1

which will give you v5.9-rc1 tag. What you can fetch from the bundle can be listed by using the list-heads subcommand on the bundle.

And starting from that point, you would be able to do things like
    $ git checkout -b my-fork-of-5.9-rc1 v5.9-rc1

Now, assuming that your original question indeed came from thinking of a bundle like a patch and not like a repository, we have a question for you. What in

    $ git bundle --help

gave such an incorrect impression? The documentation must be at fault here, and we need to clarify so that future readers of it will not be confused into the same misconception.

Thanks.
Previous: Andreas SchwabNext: Andreas Grünbacher
Message 9 of 14 in “Apply git bundle to source tree?”
  1. Andreas GrünbacherSep 18, 2020
  2. Taylor BlauSep 18, 2020
  3. Andreas GrünbacherSep 18, 2020
  4. Taylor BlauSep 18, 2020
  5. Andreas GrünbacherSep 18, 2020
  6. Andreas SchwabSep 18, 2020
  7. Andreas GrünbacherSep 18, 2020
  8. Andreas SchwabSep 18, 2020
  9. Junio C HamanoSep 18, 2020
  10. Andreas GrünbacherSep 18, 2020
  11. Konstantin RyabitsevSep 18, 2020
  12. Andreas GrünbacherSep 18, 2020
  13. Thomas Guyot-SionnestSep 19, 2020
  14. brian m. carlsonSep 19, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.