Created
July 7, 2017 23:33
-
-
Save dnlserrano/2a3783aa7f2e324a574c8c22f6ced751 to your computer and use it in GitHub Desktop.
prepare-commit-msg git hook
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 | |
ticket=$(git symbolic-ref --short HEAD | sed 's/.*\/\([a-zA-Z]*\)-\([0-9]*\).*/JIRA \1-\2/g') | |
original_msg=$(cat $1) | |
echo "\n\n$ticket\n$original_msg" > $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to use this with vim fugitive, you have to check if the message already has the ticket (vim fugitive does its commit using
git commit -F file_with_commit_msg
):