Skip to content

Instantly share code, notes, and snippets.

@wilyJ80
Last active November 23, 2025 13:46
Show Gist options
  • Select an option

  • Save wilyJ80/bda706fac4a2cbe45c9e81f019f3b8a2 to your computer and use it in GitHub Desktop.

Select an option

Save wilyJ80/bda706fac4a2cbe45c9e81f019f3b8a2 to your computer and use it in GitHub Desktop.
COMMIT ANALYTICS: get your commit count and most recent commits on all your PC! Add to .bash_profile and open the output file in your browser (optionally add a bookmark)
#!/bin/bash
SRC_FOLDER="$HOME/src"
COMMITTER_PATTERN="git|victor.bitencourt|wilyJ80"
DEST_FOLDER="$HOME/logs/log.html"
TOP=$(cat << EOF
<head>
<style>
body {
background-color: #ffeffd;
display: flex;
flex-direction: column;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
</style>
</head>
<h1>Git Logs</h1>
EOF
)
CONTENT=$(find "$SRC_FOLDER" \
-type d -name .git \
-printf '%h\n' \
| xargs -I{} \
git -C {} --no-pager log --pretty=format:"<p> <dt>%ct</dt> <dd>{}</dd> <dd>%h</dd> <dd>%cn</dd> <dd>%cd</dd> <dd>%s</dd> </p> %n" \
2>/dev/null \
| grep -E "<dd>$COMMITTER_PATTERN</dd>" \
| sort -rn \
| grep -v '^$'
)
COUNT=$(echo "$CONTENT" | wc -l)
{
echo "$TOP" "<p>COMMITS: $COUNT</p>" "$CONTENT"
} > $DEST_FOLDER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment