Skip to content

Instantly share code, notes, and snippets.

@masaru-b-cl
Last active August 29, 2015 14:02
Show Gist options
  • Save masaru-b-cl/5b461ffd4728ab9b61cb to your computer and use it in GitHub Desktop.
Save masaru-b-cl/5b461ffd4728ab9b61cb to your computer and use it in GitHub Desktop.
git-master、git-nowのお供に、"カレントブランチ名#機能名"なブランチを作ってくれるgit-feature
#!/bin/sh
# usage: git feature <feature-name>
function usage() {
echo "usage: git feature <feature-name>"
exit 1
}
if [ $# -eq 0 ]
then
echo "error: feature-name is required."
usage
elif [ $# -gt 1 ]
then
echo "error: Too many arguments."
usage
fi
WORKING_BRANCH=`git branch -l | grep "*" | cut -d " " -f 2`
git co -b $WORKING_BRANCH#$1
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment