In the .git/objects/
folder there are many folders with files within such as ab/cde...
. I understand that these are actually blobs abcde...
Is there a way to obtain a flat file listing of all blobs under .git/objects/
with no /
being used a delimitor between ab
and cde
in the example above? For e.g.
abcde....
ab812....
74axs...
I tried
/.git/objects$ du -a .
This does list recursively all folders and files within the /objects/
folder but the blobs are not listed since the command lists the folder followed by the filename (as the OS recognizes them, as opposed to git). Furthermore, the du
command does not provide a flat listing in a single column -- it provides the output in two columns with a numeric entry (disk usage) in the first column.
.git/objects/<two hex digits>/<remaining hex digits>
files are only the loose objects; packed objects take space too. There are multiple different size questions you can answer: two for loose objects, three for packed objects. These are: how much disk space does this object use directly; how big is this object once it's unpacked/loose; how big is the uncompressed object?--filter
option, new in Git 2.32 forgit rev-list
, lets you trim the set to one particular type. Otherwise, read the object type (available from the object header or themode
depending on what you're looking at) to find out what kind of object this is./.git/objects/pack
folder? (2) Are the four object types (loose or packed) also fully contained in/.git/objects/
(3) Is there a guarantee that the folder structure of/.git/objects/
always of typesubfolder/file
with no more contained subfolders?git fsck
might report as "unreachable" andgit gc
might delete.