Last active
December 14, 2015 04:29
-
-
Save Luismahou/5028189 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/sh | |
# This script will add the branch name every time the commit command is executed. | |
# To activate it: | |
# - Copy it to /path/to/your/git/repository/.git/hooks/ | |
# Getting the branch name | |
NAME=$(git rev-parse --abbrev-ref HEAD) | |
# Prepending the branch name to the commit message | |
echo '['"$NAME"'] '$(cat "$1") > "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment