Skip to content

Instantly share code, notes, and snippets.

@dillonhafer
Last active January 25, 2017 16:38
Show Gist options
  • Save dillonhafer/bb171dd2a1afbbcea5bd5d3924fe9357 to your computer and use it in GitHub Desktop.
Save dillonhafer/bb171dd2a1afbbcea5bd5d3924fe9357 to your computer and use it in GitHub Desktop.
Pre-commit hook for jira branches
#!/bin/sh
#
# Given a branch name like "feature/PHI-432-use-citext-emails"
#
# And .git/config has the following line
#
# [commit]
# template = ~/.gitmessage.projectA
#
# Then empty commit messages have [PHI-432] after the second line.
#
# To enable this hook, rename this file to "pre-commit".
issue=$(git rev-parse --abbrev-ref HEAD | grep -o 'PHI-\d*')
echo "\n\n[$issue]" > ~/.gitmessage.projectA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment