Skip to content

Instantly share code, notes, and snippets.

@dlisboa
Last active August 29, 2015 14:11
Show Gist options
  • Save dlisboa/1494c5941ad9ee59d656 to your computer and use it in GitHub Desktop.
Save dlisboa/1494c5941ad9ee59d656 to your computer and use it in GitHub Desktop.
#!/bin/sh
msgfile="$1"
branch=$(git symbolic-ref -q HEAD | cut -c12-)
temp=$(mktemp)
awk "
(NR == 1 && !/^\[$branch\]/) {
sub(/^[ ]*/, \"[$branch] \")
print
next
}
{ print }
" <$msgfile >$temp
cat $temp >$msgfile
rm $temp
@dlisboa
Copy link
Author

dlisboa commented Dec 21, 2014

Adds [branch name] to beginning of subject line if not there already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment