1.根据已有分支创建新的分支
git checkout -b newbranch origin/oldbranchname
2.本地分支和远程分支建立联系
git push --set-upstream origin newbranch
3.推送到远程仓库
git push origin newbranch 或者直接 git push
————————————————
1: git clone https://
2:
wang zhenlin@CM-DEVELOPER003 MINGW64 /d/git/AICarbon (master)
$ git branch -a
* master
remotes/origin/AICarbon/Labeling
remotes/origin/rebuild
remotes/origin/test
remotes/origin/wss/AICarbon_Add_Upsampling
remotes/origin/wss/liver_added
remotes/origin/wzl
3
wang zhenlin@CM-DEVELOPER003 MINGW64 /d/git/AICarbon (rebuild)
$ git checkout -b wzl/AICarbon_Cuda111 origin/rebuild
Switched to a new branch 'wzl/AICarbon_Cuda111'
Branch 'wzl/AICarbon_Cuda111' set up to track remote branch 'rebuild' from 'origin'.
wang zhenlin@CM-DEVELOPER003 MINGW64 /d/git/AICarbon (wzl/AICarbon_Cuda111)
// 新建分支步骤
// 1、切换分支--从20220705分支新拉一个分支,所以这里我切换到了该分支
git checkout 20220705
// 2、新建分支并且切换到该分支
git checkout -b newBranch
// 3、推送到远程仓库
git push origin newBranch
// 4、关联分支
git branch --set-upstream-to=origin/newBranch newBranch
// 或者
git push --set-upstream origin newBranch