Created
November 8, 2024 12:13
Git Daily Commit Stats Summary
This file contains 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/bash | |
# Git Daily Summary: Rollup of Files Changed, Lines Added, and Lines Deleted by Day | |
# Command: git log with custom format to show daily summary of changes in the repository | |
# Usage: Run this script to get a summary of changes per day within the specified time range. | |
# Example output is shown below. | |
# Command: | |
git log --since="1 month ago" --date=short --pretty=format:"%cd" --shortstat | \ | |
awk ' | |
/^20[0-9]{2}-[0-9]{2}-[0-9]{2}/ { | |
date=$1 | |
} | |
/files changed/ { | |
files[date]+=$1; inserted[date]+=$4; deleted[date]+=$6 | |
} | |
END { | |
for (d in files) | |
printf "%s - Files changed: %s, Lines added: %s, Lines deleted: %s\n", d, files[d], inserted[d], deleted[d] | |
} | |
' | sort | |
# Example Output: | |
# 2024-11-03 - Files changed: 86, Lines added: 12129, Lines deleted: 697 | |
# 2024-11-04 - Files changed: 12, Lines added: 2498, Lines deleted: 269 | |
# 2024-11-05 - Files changed: 11, Lines added: 1197, Lines deleted: 390 | |
# 2024-11-06 - Files changed: 13, Lines added: 860, Lines deleted: 1035 | |
# 2024-11-07 - Files changed: 24, Lines added: 1895, Lines deleted: 203 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment