Skip to content

Instantly share code, notes, and snippets.

@tpjnorton
Created July 5, 2021 21:28
Show Gist options
  • Save tpjnorton/b4e3d748268cccc658bb1061878000d2 to your computer and use it in GitHub Desktop.
Save tpjnorton/b4e3d748268cccc658bb1061878000d2 to your computer and use it in GitHub Desktop.
A quick bash function for updating Gitflow branches.
# usage: rbs [-m] -b base_branch_name
function rbs() {
OPTIND=1
BASE_BRANCH=develop
UPDATE_ACTION=rebase
while getopts "b:m" flag; do
case "${flag}" in
b) BASE_BRANCH=${OPTARG} ;;
m) UPDATE_ACTION=merge ;;
esac
done
git checkout ${BASE_BRANCH} && git pull && git checkout - && git ${UPDATE_ACTION} ${BASE_BRANCH}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment