Created
December 4, 2019 09:44
-
-
Save 155martinmoreno/e4ba0a87aa41bd97b518713320dae954 to your computer and use it in GitHub Desktop.
Shell to see lines count history of a file added to git.
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
#!/bin/sh | |
# | |
# list the given file's filesize next to each commit | |
# usage: git-fs-history path/to/file | |
# | |
if [ $# -ne 2 ]; then | |
echo "Error: invalid number of arguments." | |
exit 1 | |
fi | |
echo "Lines,Date" > $2 | |
# for all commits on this file | |
for commit in $(git log --format=%H $1); do | |
$(git checkout $commit) | |
commitDate=$(git show -s --format=%ci $commit) | |
wordCountAll=$(wc -l $1) | |
wordCount=($wordCountAll) | |
echo "${wordCount[0]},${commitDate}" >> $2 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment