1 2 3 4 5 6 7 8 9 10 11 12
#!/bin/sh # Last Change: Nov 13 2022 17:53 modified=$(git diff --cached --name-only --diff-filter=ACMR) [ -z $modified ] && exit 0 for f in $modified; do data=$(date -r $f "+%a, %d %b %Y - %T") sed -ri "1,7s/^(\S*\s*Last (Change|Modified):).*/\1 $data/gi" $f git add $f done
You can clone a snippet to your computer for local editing. Learn more.