![]() git/objects/pack/pack-*.idx | grep -v chain | sort -k3nr | head`Įcho "All sizes are in kB's. # list all objects including their size, sort by size, take top 10 # set the internal field separator to line break, so that we can iterate easily over the verify-pack output # Shows you the largest objects in your repo's pack file. I've found this script very useful in the past for finding large (and non-obvious) objects in a git repository: So if the script here does not cut it for you (and you have a decently recent version of git), look into git-filter-repo -analyze or git rev-list -disk-usage ( examples). You would not spot directories or branches containing humongous numbers of small files, for example. Sometimes a list of big files is just not enough to find out what the problem is. However, mind that this metric also has its caveats, as is mentioned in the documentation. ![]() If you want to see how much space a file occupies if not checked out, you can use %(objectsize:disk) instead of %(objectsize). What this script displays is the size each file would have in the working directory. Understanding the meaning of the displayed file size This will leave you with something like this. To generate output that's more suitable for further processing by computers, omit the last two lines of the base script. To exclude files that are present in HEAD, insert the following line: grep -vF -file= 2^20' | To achieve further filtering, insert any of the following lines before the sort line. MacOS users: Since numfmt is not available on macOS, you can either omit the last line and deal with raw byte sizes or brew install coreutils. When you run above code, you will get nice human-readable output like this. $(command -v gnumfmt || echo numfmt) -field=2 -to=iec-i -suffix=B -padding=7 -round=nearest ![]() Git cat-file -batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | The Base Script git rev-list -objects -all | On my trusty Athlon II X4 system, it handles the Linux Kernel repository with its 5.6 million objects in just over a minute. This shell script displays all blob objects in the repository, sorted from smallest to largest.įor my sample repo, it ran about 100 times faster than the other ones found here.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |