Created
July 6, 2011 08:38
-
-
Save paulbaumgart/1066845 to your computer and use it in GitHub Desktop.
Plot the length history of a file in a git repo
This file contains hidden or 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
file_length_history() { | |
export filename="$1" | |
( | |
echo set xlabel \"Days Ago\" | |
echo set ylabel \"Bytes\" | |
echo plot \"-\" title \"$filename\" with lines | |
now=$(date +"%s") | |
git log --reverse --format=format:"%at %H" "$filename" | \ | |
while read -a line; do | |
echo -en "$(echo scale=10\; \(${line[0]} - $now\) / 24 / 60 / 60 | bc)\t" | |
git cat-file -s $(git ls-tree ${line[1]} -- "$filename" | cut -d ' ' -f 3 | cut -f 1) | |
done | |
unset filename | |
) | gnuplot -p | |
} | |
# Example: | |
# file_length_history Current-Todo.md | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment