Skip to content

Instantly share code, notes, and snippets.

@acosonic
Created November 17, 2021 09:07
Show Gist options
  • Save acosonic/71c712eae5b12ba28e9e9e59a7d48478 to your computer and use it in GitHub Desktop.
Save acosonic/71c712eae5b12ba28e9e9e59a7d48478 to your computer and use it in GitHub Desktop.
Git pre-commit hook to check for valid Redmine commit message. Add this to .git/hooks/commit-msg and chmod to be executable
#!/bin/bash
# Add this to .git/hooks/commit-msg and chmod to be executable
# Author Aleksandar Pavic - buy my Redmine book - redmine cookbook
MSG="$1"
if ! grep -qE "refs \#[0-9].*" "$MSG";then
cat "$MSG"
echo "Valid comments needs to have refs #issueID 'refs # ID of Redmine ticket'"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment