Skip to content

Instantly share code, notes, and snippets.

@AlexDenisov
Last active November 8, 2016 13:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save AlexDenisov/1e3ccbb59a53c5e05d9a to your computer and use it in GitHub Desktop.
Save AlexDenisov/1e3ccbb59a53c5e05d9a to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# Converts branch name 'MAPP-452_how-is-it-going' into a commit message 'MAPP-452 How is it going'
#
if ! [ -z $2 ]
then
if ! [ "message" == $2 ]
then
exit
fi
fi
branchname=$(git branch | grep ^* | sed 's/\* //g' | sed 's/f\///g')
if ! [[ "$branchname" == MAPP-* ]]
then
exit
fi
original=`cat $1`
echo $branchname | awk -F_ '{ gsub("-", " ", $2); print "["$1"] " toupper(substr($2, 1, 1)) substr($2, 2, length($2)) }' > $1
echo "$original" >> $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment