Tired to forget to write every goddam time the branch name on the commit messsage? This got you covered:
- Add the prepare-commit-msg file to your
.git/hooks/folder; - Then,
chmod +x prepare-commit-msg; - PROFIT!
Tired to forget to write every goddam time the branch name on the commit messsage? This got you covered:
.git/hooks/ folder;chmod +x prepare-commit-msg;| #!/bin/bash | |
| BRANCHNAME=$(git branch | grep '*' | sed 's/* //') | |
| if [ -n "$BRANCHNAME" ] | |
| then | |
| echo "" >> "$1" | |
| echo $BRANCHNAME >> "$1" | |
| fi |
Improved version
Requires
git config commit.status = false. Also, works best with templates 😉