Skip to content

Instantly share code, notes, and snippets.

@unclecheese
Created September 22, 2014 23:31
Show Gist options
  • Save unclecheese/42b3a2be84f931299e39 to your computer and use it in GitHub Desktop.
Save unclecheese/42b3a2be84f931299e39 to your computer and use it in GitHub Desktop.
Bash script for creating new hotfix branch
#!/bin/sh
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ "$CURRENT_BRANCH" != "master" ];then
echo $CURRENT_BRANCH
echo "Please switch to the master branch to start a new feature."
exit
fi
echo "What is the name of this feature (e.g. my-feature-name)? "
read FEATURE_NAME
git checkout -b "feature/$FEATURE_NAME"
#!/bin/sh
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ "$CURRENT_BRANCH" != "master" ];then
echo $CURRENT_BRANCH
echo "Please switch to the master branch to start a new hotfix."
exit
fi
echo "What is the name of this hotfix, e.g. the JIRA card number? "
read HOTFIX_NAME
git checkout -b "hotfix/$HOTFIX_NAME"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment