Skip to content

Instantly share code, notes, and snippets.

@ei-grad
Last active April 30, 2025 10:34
Show Gist options
  • Save ei-grad/ee64f3dd2f23b6564f6bda4aeb0f91da to your computer and use it in GitHub Desktop.
Save ei-grad/ee64f3dd2f23b6564f6bda4aeb0f91da to your computer and use it in GitHub Desktop.
#!/bin/bash
git log --pretty=%H "$@" | while read -r sha; do
added=$(git show --word-diff=porcelain "$sha" | grep '^+' | cut -c2- | wc -w)
removed=$(git show --word-diff=porcelain "$sha" | grep '^-' | cut -c2- | wc -w)
git show --pretty="- hash: %h%n date: %aI%n author: |-2%w(0,0,4)%n%an <%ae>%w(0,0,2)%nmessage: |-2%w(0,0,4)%n%s%w(0,0,0)%n added: $added%n removed: $removed" -s "$sha"
done
#!/usr/bin/env python
import sys
from yaml import safe_load
import pandas as pd
import matplotlib.pyplot as plt
df = pd.DataFrame.from_records(safe_load(sys.stdin), index="date").sort_index()
pd.DataFrame({"added": df.added.cumsum(), "removed": df.removed.cumsum()}).plot()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment