Created
July 22, 2014 18:30
-
-
Save waiting-for-dev/b17e3ba956c29f8972c3 to your computer and use it in GitHub Desktop.
Append Issue Number to Commit Message Automatically With Git Hooks - http://waiting-for-dev.github.io/blog/2014/07/19/append-issue-number-to-commit-message-automatically-with-git-hooks/
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 | |
if [ x = x${2} ]; then | |
BRANCH_NAME=$(git symbolic-ref --short HEAD) | |
STORY_NUMBER=$(echo $BRANCH_NAME | sed -n 's/.*-\([0-9]\)/\1/p') | |
if [ x != x${STORY_NUMBER} ]; then | |
sed -i.back "1s/^/\n\n[#$STORY_NUMBER]/" "$1" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment