5 # See if it already exists
6 git rev-parse $branch_name >/dev/null
7 if [[ $? -eq 0 ]] ; then
8 # Just checkout what they asked
9 git checkout "$branch_name"
11 # Make sure we have the latest origin/$branch_name to branch
13 exists_remote=$(git branch | grep -x " origin/$branch_name" | wc -l)
14 if [[ $exists_remote -eq 0 ]] ; then
15 # Specifying stable to get the last released code
16 git checkout -b "$branch_name" origin/stable
17 # Go ahead and put the branch out on the server
18 git push origin "$branch_name"
19 # Setup the merge property so that pulls come from the right place (instead of stable)
20 git config --replace-all "branch.$branch_name.merge" "refs/heads/$branch_name"
23 git checkout -b "$branch_name" "origin/$branch_name"