Append branch name to ticket
#!/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
prepare-commit-msg.sh hosted by GitHub