Last active
July 15, 2019 09:49
-
-
Save whalemare/a838e991b5c5203242cb6c75ec535f73 to your computer and use it in GitHub Desktop.
Add link to redmine ticket by working branch name
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
message=$(cat "$1") | |
currentBranch=$(git rev-parse --abbrev-ref HEAD) | |
currentBranch=$(echo "$currentBranch" | grep -o '[a-zA-Zа-яА-Я]\+-\d*') | |
echo "current ticket = $currentBranch" | |
countTrackerWords=$(echo "$message" | grep -w -c Tracker) | |
if [ $countTrackerWords == 0 ] && [ ! -z $currentBranch ] | |
then { | |
echo "" | |
echo "Redmine:" | |
echo "refs $currentBranch" | |
} >> "$1" | |
fi |
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
message=$(cat "$1") | |
currentBranch=$(git rev-parse --abbrev-ref HEAD) | |
currentBranch=$(echo "$currentBranch" | grep -o '[a-zA-Zа-яА-Я]\+-\d*') | |
echo "current ticket = $currentBranch" | |
countTrackerWords=$(echo "$message" | grep -w -c Tracker) | |
if [ $countTrackerWords == 0 ] && [ ! -z $currentBranch ] | |
then { | |
echo "" | |
echo "Tracker:" | |
echo "$currentBranch" | |
} >> "$1" | |
fi |
cat commit-msg
echo "CTRL+V text here" > commit-msg
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is git hook, which adds to the end of message your commits the #id of the redmine task.
How use
your/project/path/.git/hooks/commit-msg.sample
commit-msg.sample
tocommit-msg
for enable this git hookfor geeks: not tested, but you need do something like this