auto-update modified date on commit

#!/bin/sh
# Contents of .git/hooks/pre-commit
# Replace `modified` timestamp with current time

git diff --cached --name-status | egrep -i "^(A|M).*\.(md)$" | while read a b; do
  cat "$b" | sed "/---.*/,/---.*/s/^modified:.*$/modified: $(date "+%Y-%m-%d %H:%M")/" > tmp
  mv tmp "$b"
  git add "$b"
done

modified from https://mademistakes.com/notes/adding-last-modified-timestamps-with-git/

Nothing playing
00:00
0