Last active
February 21, 2019 16:14
-
-
Save shaunburch/ff87c0e1bfb08f0c67e0ae2fac21468b to your computer and use it in GitHub Desktop.
Git hook to prepend branch & issue number to commits
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/sh | |
# Author: rmcdaniel | |
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/^/$STORY_NUMBER /" "$1" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment