Is it possible to show the total file size difference between two commits? Something like:
$ git file-size-diff 7f3219 bad418 # I wish this worked :)
-1234 b
A comment to the script: git-file-size-diff, suggested by patthoyts. The script is very useful, however, I have found two issues:
When someone change permissions on the file, git returns a another type in the case statement:
T) echo >&2 "Skipping change of type"
continue ;;
If a sha-1 value doesn't exist anymore (for some reason), the script crashes. You need to validate the sha before getting the file size:
$(git cat-file -e $D)
if [ "$?" = 1 ]; then continue; fi
The complete case statement will then look like this:
case $M in
M) $(git cat-file -e $D)
if [ "$?" = 1 ]; then continue; fi
$(git cat-file -e $C)
if [ "$?" = 1 ]; then continue; fi
bytes=$(( $(git cat-file -s $D) - $(git cat-file -s $C) )) ;;
A) $(git cat-file -e $D)
if [ "$?" = 1 ]; then continue; fi
bytes=$(git cat-file -s $D) ;;
D) $(git cat-file -e $C)
if [ "$?" = 1 ]; then continue; fi
bytes=-$(git cat-file -s $C) ;;
T) echo >&2 "Skipping change of type"
continue ;;
*)
echo >&2 warning: unhandled mode $M in \"$A $B $C $D $M $P\"
continue
;;
esac