Hy!
Is there a way to get a list of all commits stored in a git bundle without cloning it first?
Getting the heads is easy, but I couldn't find a way to get a full log out of it.
Hy!
Is there a way to get a list of all commits stored in a git bundle without cloning it first?
Getting the heads is easy, but I couldn't find a way to get a full log out of it.
It's not possible without writing some specialised software to walk through the pack included in the bundle. If the bundle was created with negative refs, it's possible that it will include deltas that are not resolvable using only objects in the bundle (the pack embedded in the bundle can be thin).
Cloning the bundle (at least to a bare clone) will split out the refs and and index the pack, producing a format that standard git commands can work with, so it's the simplest way (in terms of integration effort) to read it.
One thing you can do to "preview" a bundle before merging it in is to simply add it as a remote repo, and then you can fetch from it and access the tracking refs. So something like:
git remote add bundle /path/to/bundle
git remote update bundle
and now you can do gitk master...bundle/master
etc. to compare branches in the bundle compared to your local repo, and finally git pull bundle master
to merge it in.
Once you're done, simply clean up with git remote rm bundle
git reset --hard HEAD
if you're left with conflicts, git reset --hard HEAD@{1}
if the auto-merge was successful) –
Polonaise Fetching from the bundle, as suggested in araqnid's answer, remains the easiest solution.
Anything else (meaning without cloning/fetching from the bundle) would involve decoding the git bundle
format.
Which is slightly easier to do with Git 2.25.1 (Feb. 2020), since the technical details of the bundle format have been documented.
See commit 7378ec9 (07 Feb 2020) by Masaya Suzuki (draftcode
).
(Merged by Junio C Hamano -- gitster
-- in commit e99c325, 12 Feb 2020)
See discussion.
doc
: describe Git bundle formatSigned-off-by: Masaya Suzuki
The bundle format was not documented. Describe the format with ABNF and explain the meaning of each part.
(ABNF: Augmented Backus–Naur form, a metalanguage based on Backus–Naur form (BNF), but consisting of its own syntax and derivation rule)
See Documentation/technical/bundle-format.txt
for more:
bundle = signature *prerequisite *reference LF pack
signature = "# v2 git bundle" LF
prerequisite = "-" obj-id SP comment LF
comment = *CHAR
reference = obj-id SP refname LF
pack = ... ; packfile
© 2022 - 2024 — McMap. All rights reserved.
git clone -ns /path/to/mine /path/to/temp
makes about the cheapest possible temp clone, a few hundred KB tops, but it's definitely a temp clone unless you understand thats
option. Anyway, make that, fetch the bundle into it as araqnid said, and you're golden. I don't like the bare clones araqnid mentioned for this, often enough I want to dink around and break things that require a checkout. – Shroyer