Skip to content

Instantly share code, notes, and snippets.

@waiting-for-dev
Created July 22, 2014 18:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waiting-for-dev/b17e3ba956c29f8972c3 to your computer and use it in GitHub Desktop.
Save waiting-for-dev/b17e3ba956c29f8972c3 to your computer and use it in GitHub Desktop.
#!/bin/sh
if [ x = x${2} ]; then
BRANCH_NAME=$(git symbolic-ref --short HEAD)
STORY_NUMBER=$(echo $BRANCH_NAME | sed -n 's/.*-\([0-9]\)/\1/p')
if [ x != x${STORY_NUMBER} ]; then
sed -i.back "1s/^/\n\n[#$STORY_NUMBER]/" "$1"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment