robbyrussell (owner)

Revisions

gist: 65324 Download_button fork
public
Description:
automatically add LH # to your git commit messages when you use LH_* naming conventions
Public Clone URL: git://gist.github.com/65324.git
Embed All Files: show embed
commit-msg.sh #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/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