Created
February 16, 2009 19:41
-
-
Save robbyrussell/65324 to your computer and use it in GitHub Desktop.
automatically add LH # to your git commit messages when you use LH_* naming conventions
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 | |
| # | |
| # Will append the current Lighthouse ticket number to the commit message automatically | |
| # when you use the LH_* branch naming convention. | |
| # | |
| # Drop into .git/hooks/commit-msg | |
| # chmod +x .git/hooks/commit-msg | |
| commit_message=$1 | |
| ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
| branch=${ref#refs/heads/} | |
| if [[ $branch =~ LH_(.*) ]] | |
| then | |
| lighthouse_ticket=${BASH_REMATCH[1]} | |
| echo >&2 "[#${lighthouse_ticket}]" >> "$1" | |
| exit 0 | |
| fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment