Last active
December 31, 2016 22:04
-
-
Save taupecat/926ecf316b9ecd0c424e03dd94da9255 to your computer and use it in GitHub Desktop.
Automattically prepend the branch name to the git commit. Useful for integrations with JIRA, Slack, etc. When working with git flow, this will ignore the word before the slash (feature/hotfix/release).
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 | |
# | |
# Prepend the Branch Name to the commit | |
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD | sed 's/.*\///') | |
if [ -n "$BRANCH_NAME" ] && [ "$BRANCH_NAME" != "master" ] && [ "$BRANCH_NAME" != "develop" ]; then | |
echo "[#$BRANCH_NAME] $(cat $1)" > $1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment