Skip to content

Instantly share code, notes, and snippets.

@jstruzik
jstruzik / pre-commit.sh
Created January 10, 2020 15:31
Git pre-commit hook to check copyright headers for current year
#!/bin/sh
readonly FILES=$(git diff --diff-filter=ACMRTUXB --cached --name-only)
readonly CURRENT_YEAR=$(date +"%Y")
for f in $FILES; do
head -10 $f | grep -i copyright 2>&1 1>/dev/null || continue
if ! grep -i -e "copyright.*$CURRENT_YEAR" $f 2>&1 1>/dev/null; then
INVALID_FILES="$INVALID_FILES $f"

Keybase proof

I hereby claim:

  • I am jstruzik on github.
  • I am jstruzik (https://keybase.io/jstruzik) on keybase.
  • I have a public key ASAy-45ftEDyXos5Rwee-5-35ZDa6_AX3QP3z803FvL7xwo

To claim this, I am signing this object:

@jstruzik
jstruzik / copyright_doc_update_git_diff.sh
Last active May 9, 2016 20:25
Update PHPDoc copyright date only for modified files between branches