#!/bin/bash # echo '[ -s "$(pwd)/pre-commit.sh" ] && "$(pwd)/pre-commit.sh"' >> .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit setdate() { [[ ! "$1" =~ .*\.adoc$ ]] && return # geƤndertes adoc date=$(date -Iseconds) sed -i "s/^:docdatetime:.*\$/:docdatetime: $date/" "$1" git add "$1" #echo "$1: $date" } git diff --cached --name-only | while read file; do setdate "$file"; done #git add *.adoc