Skip to content

Instantly share code, notes, and snippets.

@robertpro
Last active December 6, 2019 19:07
Show Gist options
  • Save robertpro/684deeb81e8a6f84ec9e456094fad262 to your computer and use it in GitHub Desktop.
Save robertpro/684deeb81e8a6f84ec9e456094fad262 to your computer and use it in GitHub Desktop.
BASE_BRANCH="upgrade"
BRANCH=$1
show_help() {
echo "./${0} BRANCH_NAME"
exit 1
}
if ! [[ "$BRANCH" ]]; then
show_help
fi
git checkout $BASE_BRANCH
git pull
if ! git checkout "${BRANCH}"; then
echo "Branch '${BRANCH}' does not exist."
show_help
fi
git pull
git rebase $BASE_BRANCH
git push -f
git checkout $BASE_BRANCH
# shellcheck disable=SC2063
git branch | grep "*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment