Skip to content

Instantly share code, notes, and snippets.

@koko1000ban
Created July 19, 2013 03:59
Show Gist options
  • Save koko1000ban/6035046 to your computer and use it in GitHub Desktop.
Save koko1000ban/6035046 to your computer and use it in GitHub Desktop.
#!/bin/sh
# enable debug mode
if [ "$DEBUG" = "yes" ]; then
set -x
fi
usage() {
echo "usage: git merge-master <release_version>"
echo
echo "this command exec creating release branch and merge it to master branch"
echo
}
main() {
if [ $# -lt 1 ]; then
usage
exit 1
fi
RELESE_VERSION=$1
CURRENT_BRANCH=`git symbolic-ref --short HEAD`
if ! [ "$CURRENT_BRANCH" = 'develop' ]; then
git checkout develop
fi
git pull --rebase
git checkout -b release/$RELESE_VERSION
git checkout master
git merge --no-ff release/$RELESE_VERSION
git push origin master
git push origin release/$RELESE_VERSION
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment