# Make pretty branch names, translated from https://gist.github.com/JoshNavi/8bc9a12b7492fc093b2c8b0bb8b0473e#create_branch function create_branch() { local branch_name=$argv[1] if [[ -z "$branch_name" ]] then echo "Need to pass a branch name to use" return 1 fi # Change this to whatever your team's project key is local ticket_key="YO" local ticket_number=$argv[2] # Change this to your name local default_user="india" local user=$argv[3] if [[ -z "$user" ]] then user=$default_user fi local new_branch="$user/$branch_name" if [[ -n $ticket_number ]] then local new_branch="$user/$ticket_key-$ticket_number/$branch_name" fi echo "Creating branch and checking out $new_branch" command git checkout -b "$new_branch" } # Examples: # # create_branch the-branch-name # git checkout -b ia/the-branch-name # # create_branch the-branch-name 111 # git checkout -b ia/YO-111/the-branch-name # # create_branch the-branch-name 111 mob # git checkout -b mob/YO-111/the-branch-name