Skip to content

Instantly share code, notes, and snippets.

@hodgestar
Created March 3, 2015 09:49
Show Gist options
  • Save hodgestar/b0292ae8670834499d37 to your computer and use it in GitHub Desktop.
Save hodgestar/b0292ae8670834499d37 to your computer and use it in GitHub Desktop.
Git Flow Feature helper script.
#!/bin/bash
CMD="$1"
shift 1
function get_feature () {
FEATURE=`git flow feature | grep '^\* ' | sed 's/^\* //'`
ISSUE=`echo "$FEATURE" | sed -e 's/issue-\([0-9]*\)-.*/\1/'`
echo "Feature: $FEATURE (issue: $ISSUE)"
}
case "$CMD" in
"")
git flow feature
;;
start)
git flow feature "$CMD" "$@"
;;
track)
git flow feature "$CMD" "$@"
;;
finish|publish|diff|checkout|pull)
get_feature
git flow feature "$CMD" "$FEATURE"
;;
pr)
get_feature
git flow feature publish "$FEATURE" && hub pull-request -i "$ISSUE" -b develop
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment