当前位置:   article > 正文

git拉取并创建自己分支推送远端_git push 新的分支

git push 新的分支

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: 

  1. wang zhenlin@CM-DEVELOPER003 MINGW64 /d/git/AICarbon (master)
  2. $ git branch -a
  3. * master
  4. remotes/origin/AICarbon/Labeling
  5. remotes/origin/rebuild
  6. remotes/origin/test
  7. remotes/origin/wss/AICarbon_Add_Upsampling
  8. remotes/origin/wss/liver_added
  9. remotes/origin/wzl

  1. wang zhenlin@CM-DEVELOPER003 MINGW64 /d/git/AICarbon (rebuild)
  2. $ git checkout -b wzl/AICarbon_Cuda111 origin/rebuild
  3. Switched to a new branch 'wzl/AICarbon_Cuda111'
  4. Branch 'wzl/AICarbon_Cuda111' set up to track remote branch 'rebuild' from 'origin'.
  5. wang zhenlin@CM-DEVELOPER003 MINGW64 /d/git/AICarbon (wzl/AICarbon_Cuda111)
  1. // 新建分支步骤
  2. // 1、切换分支--从20220705分支新拉一个分支,所以这里我切换到了该分支
  3. git checkout 20220705
  4. // 2、新建分支并且切换到该分支
  5. git checkout -b newBranch
  6. // 3、推送到远程仓库
  7. git push origin newBranch
  8. // 4、关联分支
  9. git branch --set-upstream-to=origin/newBranch newBranch
  10. // 或者
  11. git push --set-upstream origin newBranch

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/762634
推荐阅读
相关标签
  

闽ICP备14008679号