Skip to content

Instantly share code, notes, and snippets.

@vitosamson
Last active August 29, 2015 14:11
Show Gist options
  • Save vitosamson/63f5e751108ebd6ae674 to your computer and use it in GitHub Desktop.
Save vitosamson/63f5e751108ebd6ae674 to your computer and use it in GitHub Desktop.
git-size.sh
#!/bin/bash
dir=$1
usage() {
echo "usage: git-size.sh /path/to/repo"
exit 1
}
get_size() {
cd $dir
commits=$(git log --pretty=oneline --abbrev-commit | awk {'print $1'})
current_commit=$(git log --pretty=oneline --abbrev-commit | head -1 | awk {'print $1'})
for commit in $commits; do
git checkout $commit 2>/dev/null
echo $(du -sh -I .git | awk {'print $1'}) - $(git show --oneline -s $commit)
done
git checkout $current_commit
}
if [ -z $dir ]; then
usage
fi
get_size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment