Created
March 25, 2020 20:59
-
-
Save klopp/c37c1de5ae8a93d896494b0f050d7f81 to your computer and use it in GitHub Desktop.
Add branch name to commit message
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/bash | |
NAME=$(git branch | grep '' | sed 's/ //') | |
MSG=$(head -n 1 "$1"); | |
if [[ ! "$MSG" =~ "$NAME" ]]; then | |
echo "$NAME"' '"$(cat $1)" > "$1" | |
DESCRIPTION=$(git config branch."$NAME".description) | |
if [ -n "$DESCRIPTION" ]; then | |
echo "" >> "$1" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment