Skip to content

Instantly share code, notes, and snippets.

@astery
Created April 27, 2015 12:50
Show Gist options
  • Save astery/3ee3023403854400168f to your computer and use it in GitHub Desktop.
Save astery/3ee3023403854400168f to your computer and use it in GitHub Desktop.
Append branch number for every commit message
#!/bin/bash
#
# Append issue number for every commit message
#
ISSUE_NO=$(git branch | grep -oP '(?<=\* issue\/)\d+')
APPEND="Task number: #$ISSUE_NO"
if [[ -n "$ISSUE_NO" ]]; then
MESSAGE=$(cat $1)
printf "%s\n\n%s" "$MESSAGE" "$APPEND" > $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment