Created
September 28, 2011 02:15
-
-
Save elecnix/1246823 to your computer and use it in GitHub Desktop.
bugzid in git commit message, for lazy rabbits
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 | |
# First cd to your git repo | |
# Execute this script. | |
# Create a feature branch by the name of case you are working on. | |
# (The branch name can include a dash followed by a keyword or two) | |
# Work hard. | |
# 'git commit' will open your editor with bugzid:1234 filled-in. | |
# Append a message, and voilà! | |
echo '#!/bin/sh | |
case "$2,$3" in | |
template,) | |
sed -i "s/\$bugzid/$(git symbolic-ref HEAD|sed s#refs/heads/##|sed s#-.*##)/" "$1" ;; | |
*) ;; | |
esac | |
' > .git/hooks/prepare-commit-msg | |
chmod a+x .git/hooks/prepare-commit-msg | |
git config commit.template ~/.git-commit-template | |
echo 'bugzid:$bugzid' > ~/.git-commit-template |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment