Revisions
-
josephdpurcell revised this gist
Oct 21, 2014 . 1 changed file with 12 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -28,14 +28,22 @@ # Exit status of non zero will lead to a failed commit. # Get the name of the branch in the current working tree. NAME=$(git symbolic-ref -q --short HEAD) # Check the branch name for a 5 to 7 digit number (an issue number). if [ `uname -s` = 'Darwin' ] then ISSUE_NUMBER=`expr "$NAME" : '\([0-9]*\)'` else ISSUE_NUMBER=`expr match "$NAME" '\([0-9]\{5,7\}\)'` fi # If branch contains a match for an issue number prepend the commit # message with 'Ref <issue_number> <commit message>. if [ -n "$ISSUE_NUMBER" ] then OLD_IFS=$IFS IFS='' echo "Ref $ISSUE_NUMBER\n"$(cat "$1") > "$1" IFS=$OLD_IFS fi -
aczietlow created this gist
Oct 8, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ #!/bin/sh # # An example hook script to prepare the commit log message. # Called by "git commit" with the name of the file that has the # commit message, followed by the description of the commit # message's source. The hook's purpose is to edit the commit # message file. If the hook fails with a non-zero status, # the commit is aborted. # # To enable this hook, rename this file to "prepare-commit-msg" and # place it in .git/hooks. # # To enable this for all git projects uses the global configuration # 'init.templatedir'. Create a directory for git templates and a # subdirectory for hooks. # > mkdir -p ~/.git_template/hooks # Use the following command to configure this as your git templates # directory. # > git config --global init.templatedir '~/.git_template' # # Now when you init a new git repo, the hook directory along with # any hooks will automatically be placed in the new project git # repo. # # You can also run 'git init' on an existing repo to have the # reinitialized with the latest templates. # # Exit status of non zero will lead to a failed commit. # Get the name of the branch in the current working tree. NAME=$(git branch | grep '*' | sed 's/* //') # Check the branch name for a 5 to 7 digit number (an issue number). ISSUE_NUMBER=`expr match "$NAME" '\([0-9]\{5,7\}\)'` # If branch contains a match for an issue number prepend the commit # message with 'Ref <issue_number> <commit message>. if [ -n "$ISSUE_NUMBER" ] then echo "Ref $ISSUE_NUMBER" $(cat "$1") > "$1" fi