Append branch name to ticket
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 | |
# | |
# Called by "git commit" with the name of the file that has the | |
# commit message, followed by the description of the commit | |
# message's source. The hook's purpose is to edit the commit | |
# message file. If the hook fails with a non-zero status, | |
# the commit is aborted. | |
# This hook will append the current branch name to | |
# the commit message if it's not already there. | |
branch=$(git symbolic-ref HEAD | awk -F/ '{print $NF}') | |
if [[ "$branch" != "master" ]]; then | |
grep -qa "$branch" "$1" || echo "\n(Branch: $branch)" >> "$1" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment