#!/bin/bash
last_count=0# Iterate over each commitgit log --reverse --pretty=format:"%H %ad" --date=short |whilereadhash date;do# Check out the commit git checkout $hash&> /dev/null
# Count the words in markdown fileswords=$(find src -type f -not -path '*/\.*' -name '*.md' -exec cat {} + | wc -w)# Compare with the last count and output only if differentif["$words" -ne "$last_count"];thenecho"$date,$words"last_count=$wordsfidone# Check out the original branchgit checkout main