Created
October 7, 2022 17:25
-
-
Save chrismwendt/ae6d2afbcb6715dd4a1d897b8e4104ad to your computer and use it in GitHub Desktop.
Prints the number of commits on <branch> in each of the last <buckets> seconds/minutes/hours/days.
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
#!/usr/bin/env bash | |
branch="$1" | |
buckets="$2" | |
if [ -z "$buckets" ]; then | |
echo "Usage: git-log-histogram <branch> <buckets>" | |
echo | |
echo "Prints the number of commits on <branch> in each of the last <buckets> seconds/minutes/hours/days." | |
echo | |
exit 1 | |
fi | |
echo "Last $buckets seconds:" | |
env TZ=UTC0 git log "$branch" --quiet --date='format-local:%Y-%m-%d %H:%M:%SZ' --format="%cd" --since="$buckets seconds ago" | uniq -c | |
echo | |
echo "Last $buckets minutes:" | |
env TZ=UTC0 git log "$branch" --quiet --date='format-local:%Y-%m-%d %H:%MZ' --format="%cd" --since="$buckets minutes ago" | uniq -c | |
echo | |
echo "Last $buckets hours:" | |
env TZ=UTC0 git log "$branch" --quiet --date='format-local:%Y-%m-%d %HZ' --format="%cd" --since="$buckets hours ago" | uniq -c | |
echo | |
echo "Last $buckets days:" | |
env TZ=UTC0 git log "$branch" --quiet --date='format-local:%Y-%m-%dZ' --format="%cd" --since="$buckets days ago" | uniq -c | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment