[개발일반] git log stats --all 사용

ITWeb/개발일반 2019. 2. 22. 16:32

귀차니즘....

recursive 하게 submodule 가져와서도 해야 하는데...

--submodule


#!/usr/bin/env bash


git stash

git pull


DAYS_AGO=$1

DATE=`date -v -"$DAYS_AGO"d +%F`

PWD=`pwd`


echo "Date : $DATE" > "git-stats-$DATE.log"

echo "Date : $DATE" >> "git-stats-all.log"

# This script must exist under git repository.


echo "[Commit Statistics]" >> "git-stats-$DATE.log"

echo "[Commit Statistics]" >> "git-stats-all.log"

# total commit stats

USER_COUNT=`git log --before="$DATE 23:59:59" --after="$DATE 00:00:00" --all --format='%aN %ce' | sort -u | wc -l`

echo "Total Commit Users : $USER_COUNT" >> "git-stats-$DATE.log"

echo "Total Commit Users : $USER_COUNT" >> "git-stats-all.log"

git log --shortstat --before="$DATE 23:59:59" --after="$DATE 00:00:00" --all | grep -E "fil(e|es) changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "files changed: ", files, "lines inserted: ", inserted, "lines deleted: ", deleted }' >> "git-stats-$DATE.log"

git log --shortstat --before="$DATE 23:59:59" --after="$DATE 00:00:00" --all | grep -E "fil(e|es) changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "files changed: ", files, "lines inserted: ", inserted, "lines deleted: ", deleted }' >> "git-stats-all.log"

echo "" >> "git-stats-$DATE.log"

echo "" >> "git-stats-all.log"


echo "[Committers]" >> "git-stats-$DATE.log"

echo "[Committers]" >> "git-stats-all.log"

# commit user list

git log --before="$DATE 23:59:59" --after="$DATE 00:00:00" --all --format='%aN %ce' | sort -u >> "git-stats-$DATE.log"

git log --before="$DATE 23:59:59" --after="$DATE 00:00:00" --all --format='%aN %ce' | sort -u >> "git-stats-all.log"

echo "" >> "git-stats-$DATE.log"

echo "" >> "git-stats-all.log"


echo "[Commit Logs]" >> "git-stats-$DATE.log"

echo "[Commit Logs]" >> "git-stats-all.log"

# each user commit stats

git log --before="$DATE 23:59:59" --after="$DATE 00:00:00" --all --pretty=format:'"%an", "%aD", "%s",' --shortstat --no-merges >> "git-stats-$DATE.log"

git log --before="$DATE 23:59:59" --after="$DATE 00:00:00" --all --pretty=format:'"%an", "%aD", "%s",' --shortstat --no-merges >> "git-stats-all.log"


: