Skip to content

Instantly share code, notes, and snippets.

@Layzie
Forked from fkei/git-feature-start
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Layzie/8797450 to your computer and use it in GitHub Desktop.
Save Layzie/8797450 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# git-feature-start - Git リポジトリディレクトリで、指定したブランチ名でブランチを作成し、合わせてリモートブランチも作成するコマンド
#
pushd `dirname $0` >/dev/null 2>&1
[ $? -eq 1 ] && exit 1
__script_dir=`pwd`
popd >/dev/null 2>&1
__base_dir=`dirname ${__script_dir}`
__dir=`pwd`
echo "=========="
echo " ____ _ _ _____ _ "
echo " / ___(_) |_ | ___|__ __ _| |_ _ _ _ __ ___ "
echo "| | _| | __| | |_ / _ \/ _\` | __| | | | '__/ _ \ "
echo "| |_| | | |_ | _| __/ (_| | |_| |_| | | | __/ "
echo " \____|_|\__| |_| \___|\__,_|\__|\__,_|_| \___| "
echo ""
echo ">> Start!! Directory: $__dir"
if [ ! -d ".git" ]; then
echo "[ERROR] Not a Git repository."
exit 1
fi
echo -n ">> Branch Name: "
read name
echo ""
# init
echo ">> State of the branch"
git branch -a
echo ""
echo ">> git checkout develop"
git checkout develop
echo ""
echo ">> git pull --all"
git pull --all
echo ""
echo -n ">> Do you want to run? [y|n]"
read run
echo ""
if [ "x$run" != "xy" ]; then
echo "Treatment interruption"
exit 1
fi
echo "git branch $name"
git branch $name
echo ""
echo "git checkout $name"
git checkout $name
echo ""
echo ">> push remote ripository"
echo "git push origin $name"
git push origin $name
echo ""
echo "Finish!!!!!!!!!!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment