Git/Large File Hunt

From Omnia
< Git
Revision as of 03:25, 29 June 2025 by Kenneth (talk | contribs) (Created page with "== Kill Large Files == == Find Large Files == git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | sed -n 's/^blob //p' | sort --numeric-sort --key=2 | cut -c 1-12,41- | $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest * git rev-list --objects --all: Lists all objects reachable from any reference. * git cat-file --batch-check='%(objecttype) %(objectname) %(objec...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Kill Large Files

Find Large Files

git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | sed -n 's/^blob //p' | sort --numeric-sort --key=2 | cut -c 1-12,41- | $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
  • git rev-list --objects --all: Lists all objects reachable from any reference.
  • git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)': Provides details about each object, including type, name, size, and the rest of the line.
  • sed -n 's/^blob //p': Filters the output to include only blob objects and removes the "blob " prefix.
  • sort --numeric-sort --key=2: Sorts the output numerically based on the second field (object size).
  • cut -c 1-12,41-: Extracts the first 12 characters (object ID) and everything from the 41st character onwards (file name).
  • $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest: Formats the file size to a human-readable format.

ref: [1] [2]