Last active
August 29, 2015 14:11
-
-
Save vitosamson/63f5e751108ebd6ae674 to your computer and use it in GitHub Desktop.
git-size.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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