Skip to content

Instantly share code, notes, and snippets.

@igrep
Last active September 25, 2015 01:46
Show Gist options
  • Select an option

  • Save igrep/8ce6cbc3aec9e99b1993 to your computer and use it in GitHub Desktop.

Select an option

Save igrep/8ce6cbc3aec9e99b1993 to your computer and use it in GitHub Desktop.
branch名にuser storyのidを入れてコミットメッセージにuser storyのURLを自動で貼る ref: http://qiita.com/igrep/items/17df4627192d7d9d3188
#!/bin/sh
story_id=$(git rev-parse --abbrev-ref HEAD | sed -n 's#.*stories/\([0-9]\+\).*#\1#p')
if [ -n "$story_id" ]; then
echo user story: https://www.pivotaltracker.com/story/show/$story_id >> $1
fi
$ git checkout -b stories/123456789
$ chmod +x .git/hooks/commit-msg
$ chmod +x .git/hooks/prepare-commit-msg
#!/bin/bash
story_id=$(git rev-parse --abbrev-ref HEAD | sed -n 's#.*stories/\([0-9]\+\).*#\1#p')
story_url=https://www.pivotaltracker.com/story/show/$story_id
if [ -n "$story_id" ] && ! grep --quiet -e $story_url $1 ; then
echo >> $1
echo user story: $story_url >> $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment