Git Internals and Plumbing

Low-level Git objects, refs, trees, index, commit creation, and packfile plumbing for advanced users and debugging.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all

Objects and Content Plumbing

Inspect commits, trees, blobs, and object metadata.

Write blob object

Store file content as a blob and print its object ID.

bashANYplumbingobjects
bash
git hash-object -w path/to/file

Write blob from stdin

Write blob content from standard input.

bashANYplumbingobjects
bash
printf "hello
" | git hash-object -w --stdin

Object type

Show object type.

bashANYplumbingobjects
bash
git cat-file -t <object_sha>

Object size

Show object size in bytes.

bashANYplumbingobjects
bash
git cat-file -s <object_sha>

Pretty-print object

Display object content.

bashANYplumbingobjects
bash
git cat-file -p <object_sha>

Count loose objects

Show object counts and disk usage.

bashANYplumbingobjectsstorage
bash
git count-objects -vH

Trees and Index Plumbing

Index manipulation and tree construction commands.

List tracked files

Print index entries.

bashANYplumbingindex
bash
git ls-files

List staged index entries

Include mode, object ID, and stage number.

bashANYplumbingindex
bash
git ls-files --stage

Mark file assume-unchanged

Hint that Git should skip stat checks for a path.

bashANYplumbingindexperformance
bash
git update-index --assume-unchanged path/to/file

Mark skip-worktree

Tell Git to avoid touching a path in sparse-like workflows.

bashANYplumbingindexsparse
bash
git update-index --skip-worktree path/to/file

Write current index to tree

Create a tree object from the index.

bashANYplumbingtree
bash
git write-tree

Read tree into index

Populate index from a tree-ish.

bashANYplumbingtreeindex
bash
git read-tree HEAD

Refs and Symbolic Refs

Inspect and mutate refs directly.

List refs

List local refs and object IDs.

bashANYplumbingrefs
bash
git show-ref

Format refs

Script-friendly ref iteration.

bashANYplumbingrefs
bash
git for-each-ref --format='%(refname:short) %(objectname:short)' refs/heads

Update ref atomically

Create or move a ref directly.

bashANYplumbingrefs
bash
git update-ref refs/heads/tmp <commit_sha>

Read symbolic ref

Print the symbolic target of HEAD.

bashANYplumbingrefssymbolic-ref
bash
git symbolic-ref HEAD

Pack refs

Store refs efficiently in packed-refs.

bashANYplumbingrefsstorage
bash
git pack-refs --all --prune

Commit and History Plumbing

Low-level commit creation and enumeration.

Create commit from tree

Create a commit object directly.

bashANYplumbingcommit
bash
echo "commit message" | git commit-tree <tree_sha> -p <parent_sha>

List commit IDs

Enumerate commits reachable from HEAD.

bashANYplumbinghistory
bash
git rev-list HEAD

List commits and objects

Enumerate reachable objects.

bashANYplumbinghistoryobjects
bash
git rev-list --objects HEAD

Diff tree objects

Compare tree objects without porcelain diff.

bashANYplumbingdiff
bash
git diff-tree --stat HEAD~1 HEAD

Verify commit revision

Ensure a revision resolves to a commit.

bashANYplumbingrevision
bash
git rev-parse --verify HEAD^{commit}

Transfer and Packfile Plumbing

Low-level network and pack operations often seen in advanced debugging.

Index pack file

Create index for an existing pack.

bashANYplumbingpackfile
bash
git index-pack pack-123.pack

Inspect pack contents

Examine packed object storage.

bashANYplumbingpackfile
bash
git verify-pack -v .git/objects/pack/pack-123.idx

Create pack from stdin list

Create a pack from listed objects.

bashANYplumbingpackfile
bash
printf "%s
" <object_sha> | git pack-objects out/pack

Unpack objects from stream

Inflate objects from a pack stream.

bashANYplumbingpackfile
bash
git unpack-objects < pack-123.pack