Last active
November 1, 2018 22:39
-
-
Save ggdaltoso/7e744d530b3a3e121f46d3dcfda991ee to your computer and use it in GitHub Desktop.
Prepend the branch sufix 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 | |
# Prepend the branch sufix name to commit message. | |
# | |
# Usage: | |
# Add this file at [repo]/.git/hooks/prepare-commit-msg | |
# | |
# Example: | |
# | |
# Branch name: | |
# feature/FOO-007 | |
# Commit message: | |
# FOO-007: commit message example | |
# | |
# To understand what is going on, you can go here: https://git-scm.com/docs/githooks#_prepare_commit_msg | |
BRANCH_NAME=$(git symbolic-ref --short HEAD | grep '\/.*' -o | cut -c2-9) | |
sed -i.bak -e "1s/^/$BRANCH_NAME: /" $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment