Last active
November 1, 2021 14:15
-
-
Save mosheeshel/622f295b60338adc9264f43785e4de47 to your computer and use it in GitHub Desktop.
Small script to improve git branch creation flow for users
This file contains hidden or 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
create_branch() { | |
local ORIGIN_BRANCH="origin/main" | |
if [ -z "$1" ] ; then | |
echo "branch name is required" | |
else | |
if [ ! -z "$2" ] ; then | |
local ORIGIN_BRANCH="$2" | |
fi | |
git checkout -b $1 $ORIGIN_BRANCH | |
git push -u origin $1:$1 | |
fi | |
} | |
alias branch=create_branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires: Git SCM CLI, Bash