Skip to content

Instantly share code, notes, and snippets.

@sattellite
Created December 25, 2014 14:15
Show Gist options
  • Save sattellite/d427b646e7928f3c00f0 to your computer and use it in GitHub Desktop.
Save sattellite/d427b646e7928f3c00f0 to your computer and use it in GitHub Desktop.
Git pre-commit hook for versioning
#!/usr/bin/zsh
VERFILE=lib/Data.pm
if (git diff --cached --diff-filter=M --unified=0 $VERFILE|grep VERSION 1>/dev/null)
then
exit 0
else
cat <<\EOF
WARNING: Version of the project has not been updated.
This project is using Semantic Versioning.
Information about versioning you can found at http://semver.org/
EOF
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment