Commits in a git bundle
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
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