Created
April 24, 2015 13:12
-
-
Save RauliL/f007ae3df1492ada4f84 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if test -z "${1}" | |
then | |
echo "Name of the branch missing." | |
exit 1 | |
fi | |
if ! current_branch=`git rev-parse --abbrev-ref HEAD` 2> /dev/null | |
then | |
echo "No Git repository found." | |
exit 1 | |
fi | |
if test "${current_branch}" = "master" | |
then | |
git pull origin master | |
else | |
git checkout master | |
git pull origin master | |
if ! git branch -d "${current_branch}" | |
then | |
exit 1 | |
fi | |
fi | |
git checkout -b "${1}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment