Skip to content

Instantly share code, notes, and snippets.

@nrlozdemir
Created April 6, 2020 09:37
Show Gist options
  • Save nrlozdemir/5125db680b6a1cfed7854d59d3b4ba9e to your computer and use it in GitHub Desktop.
Save nrlozdemir/5125db680b6a1cfed7854d59d3b4ba9e to your computer and use it in GitHub Desktop.
#!/bin/bash
#set -x
IFS=$'\n';
objects=`git verify-pack -v .git/objects/pack/pack-*.idx | grep -Ev "non delta|chain length|git/objects" | tr -s " " | sort -k3gr | head -n30`
output="size,SHA,location"
for y in $objects
do
# extract the size in KB
size=$((`echo $y | cut -f 3 -d ' '`/1024))
sha=`echo $y | cut -f 1 -d ' '`
other=`git rev-list --all --objects | grep $sha`
#lineBreak=`echo -e "\n"`
output="${output}\n${size},${other}"
done
echo -e $output | column -t -s ', '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment