gitgit-bundle

Commits in a git bundle


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.


Solution

  • 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