Last active
July 1, 2016 13:37
-
-
Save sletix/2865161 to your computer and use it in GitHub Desktop.
Git hook for put pivotal-ticket-id in commit msg
This file contains 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/bash | |
tempfile=`mktemp`; | |
ticket=`git branch|grep '* '|cut -f 2 -d '-'`; | |
message=`cat $1`; | |
if [[ $ticket =~ ^[0-9]{7,}$ ]]; then | |
echo -e "$message\n\n--\nPivotalTracker: [#$ticket] https://www.pivotaltracker.com/story/show/$ticket" >> "$tempfile"; | |
mv "$tempfile" "$1" | |
else | |
rm $tempfile | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Auto-adding ticket id from branch name to commit message
how to install:
use case: