gitformat-loose(5) — Linux manual page

NAME | SYNOPSIS | DESCRIPTION | LOOSE OBJECTS | GIT | COLOPHON

GITFORMAT-LOOSE(5)              Git Manual             GITFORMAT-LOOSE(5)

NAME         top

       gitformat-loose - Git loose object format

SYNOPSIS         top

       $GIT_DIR/objects/[0-9a-f][0-9a-f]/*

DESCRIPTION         top

       Loose objects are how Git stores individual objects, where every
       object is written as a separate file.

       Over the lifetime of a repository, objects are usually written as
       loose objects initially. Eventually, these loose objects will be
       compacted into packfiles via repository maintenance to improve
       disk space usage and speed up the lookup of these objects.

LOOSE OBJECTS         top

       Each loose object contains a prefix, followed immediately by the
       data of the object. The prefix contains <type> <size>\0. <type> is
       one of blob, tree, commit, or tag and size is the size of the data
       (without the prefix) as a decimal integer expressed in ASCII.

       The entire contents, prefix and data concatenated, is then
       compressed with zlib and the compressed data is stored in the
       file. The object ID of the object is the SHA-1 or SHA-256 (as
       appropriate) hash of the uncompressed data.

       The file for the loose object is stored under the objects
       directory, with the first two hex characters of the object ID
       being the directory and the remaining characters being the file
       name. This is done to shard the data and avoid too many files
       being in one directory, since some file systems perform poorly
       with many items in a directory.

       As an example, the empty tree contains the data (when
       uncompressed) tree 0\0 and, in a SHA-256 repository, would have
       the object ID
       6ef19b41225c5369f1c104d45d8d85efa9b057b53b14b4b9b939dd74decc5321
       and would be stored under
       $GIT_DIR/objects/6e/f19b41225c5369f1c104d45d8d85efa9b057b53b14b4b9b939dd74decc5321.

       Similarly, a blob containing the contents abc would have the
       uncompressed data of blob 3\0abc.

GIT         top

       Part of the git(1) suite

COLOPHON         top

       This page is part of the git (Git distributed version control
       system) project.  Information about the project can be found at 
       ⟨http://git-scm.com/⟩.  If you have a bug report for this manual
       page, see ⟨http://git-scm.com/community⟩.  This page was obtained
       from the project's upstream Git repository
       ⟨https://github.com/git/git.git⟩ on 2026-01-16.  (At that time,
       the date of the most recent commit that was found in the
       repository was 2026-01-15.)  If you discover any rendering
       problems in this HTML version of the page, or you believe there is
       a better or more up-to-date source for the page, or you have
       corrections or improvements to the information in this COLOPHON
       (which is not part of the original manual page), send a mail to
       man-pages@man7.org

Git 2.53.0.rc0                  2026-01-15             GITFORMAT-LOOSE(5)