Created
February 16, 2015 22:07
-
-
Save MarkusH/ac611c25d3e240d3277e to your computer and use it in GitHub Desktop.
Prepends the current branch name to the commit message if the branch is named stable/\d.\d.x
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 | |
branch="$(git rev-parse --abbrev-ref HEAD)" | |
if [[ ${branch} == stable/* ]] ; then | |
branch=${branch#stable/} | |
head -n1 .git/COMMIT_EDITMSG | grep -qP "\[\d\.\d\.x\]" | |
has_marker=$? | |
if [[ $has_marker == 0 ]] ; then | |
echo "[${branch}] " | cat - "${1}" > /tmp/tmpmessage | |
mv /tmp/tmpmessage "${1}" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment