Skip to content

Instantly share code, notes, and snippets.

@seesleestak
Created December 1, 2019 14:52
Show Gist options
  • Select an option

  • Save seesleestak/21052d924d1ab6fb27546a906e960cf9 to your computer and use it in GitHub Desktop.

Select an option

Save seesleestak/21052d924d1ab6fb27546a906e960cf9 to your computer and use it in GitHub Desktop.
Prefix the commit message with the current branch
# !/bin/bash
CURR_BRANCH=$(git symbolic-ref HEAD --short)
BLACKLIST=("master" "develop")
if [[ -n $CURR_BRANCH ]]; then
if [[ $(echo "${BLACKLIST[@]}" | grep --word-regexp "$CURR_BRANCH") ]]; then
git commit -m $1 "${@:2}"
else
git commit -m "$CURR_BRANCH: $1" "${@:2}"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment