Last active
March 18, 2016 14:56
-
-
Save techjacker/2fee40d6d0d9fc4e9ade to your computer and use it in GitHub Desktop.
Prepend feature branch name to commit message
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/bash | |
################################################################# | |
# | |
# prepend feature branch name to the commit message | |
# eg feature/MT-3453 -> 'MT-3453 my brilliant new feature' | |
# | |
# 1. save to .git/hooks/prepare-commit-msg | |
# 2. chmod +x .git/hooks/prepare-commit-msg | |
# | |
################################################################# | |
BRANCH_STR=$(git status | sed -n 1p) | |
if echo "$BRANCH_STR" | grep -q 'feature'; then | |
echo "${BRANCH_STR/On\ branch\ feature\//}: $(cat $1)" > $1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment