How does git know the sha1 name of the pack files?
I have a git repository, I have the index, HEAD, refs, packed-refs etc.
I don’t know the names of the pack files in .git/objects/pack
How does git figure out the name of the pack files? Is there a way to calculate the name of the pack files from the index file?
.git/objects/info/packs is the closest I’m gonna get to what I’m looking for. This file is not always present though.
One Solution collect form web for “How does git know the sha1 name of the pack files?”
As a general rule, git just reads the contents of the
objects/pack directory: it does not know a priori what the pack file SHA-1 values will be. However, when it goes to make a new pack file, it does calculate an SHA-1 and use that for the name of the pack file; and the name of the index is necessarily the same as the name of the pack-file, so if
should also exist, for instance (these names found by looking in a directory, there’s no particular significance to these SHA-1s).
There may also be
.bitmap files corresponding to any given SHA-1 (bitmaps appear to be new in git 2.0.0).
For more amusing enlightenment on pack files, see
in the git source. 🙂