Skip to content

Instantly share code, notes, and snippets.

@Mihailoff
Created July 2, 2014 18:13
Show Gist options
  • Save Mihailoff/370abf643099bf42f7b7 to your computer and use it in GitHub Desktop.
Save Mihailoff/370abf643099bf42f7b7 to your computer and use it in GitHub Desktop.
Auto prepend branch name to commit message if name not start with "MOODLE_"
# .git/hooks/prepare-commit-msg
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
if [[ ! $BRANCH_NAME =~ ^MOODLE_ ]] ; then echo "$BRANCH_NAME " | cat - "$1" > "$1.tmp" && mv "$1.tmp" "$1"; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment