Last active
January 25, 2017 16:38
-
-
Save dillonhafer/bb171dd2a1afbbcea5bd5d3924fe9357 to your computer and use it in GitHub Desktop.
Pre-commit hook for jira branches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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