Created
February 19, 2019 09:11
-
-
Save ivanbogomoloff/2e3458d11f907785c8e4574f857aa221 to your computer and use it in GitHub Desktop.
Automatically adds branch name and branch description to every commit message.
This file contains hidden or 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 | |
# Place it to .git/hooks/commit-msg and chmod +x .git/hooks/commit-msg | |
# Automatically adds branch name and branch description to every commit message. | |
# | |
NAME=$(git branch | grep '*' | sed 's/* //') | |
DESCRIPTION=$(git config branch."$NAME".description) | |
echo "$NAME"'/'$(cat "$1") > "$1" | |
if [ -n "$DESCRIPTION" ] | |
then | |
echo "" >> "$1" | |
echo $DESCRIPTION >> "$1" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment