Skip to content

Instantly share code, notes, and snippets.

@xring
Created October 27, 2023 14:05
Show Gist options
  • Save xring/3fac3a63673147a6a47cc0dcbd4b022e to your computer and use it in GitHub Desktop.
Save xring/3fac3a63673147a6a47cc0dcbd4b022e to your computer and use it in GitHub Desktop.
count user code lines in git repo
git log --since="2022-01-01" --until="2022-12-31" --numstat --pretty="%an" |
awk '
{
if (NF == 1) author = $0
else if (NF > 1) {
added[author] += $1;
removed[author] += $2;
}
}
END {
for (a in added) {
print a ": +", added[a], "- ", removed[a];
}
}' | sort -k3 -nr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment