GitLab更新代码到新分支

<-----解决无法上传到新分支的问题----->

1.将更新后的代码放入本地仓库。

2.上传项目

(1)更新到主分支

$ git add .
$ git commit -m "更新描述"
$ git push    #更新到主分支

(2)第一次上传分支

$ git add .
$ git commit -m "更新描述"
$ git push -u origin 分支名字 #第一次使用git上传

(3)上传到新分支

$ git add .
$ git commit -m "更新描述"
$ git branch 分支名字 #创建新分支
$ git checkout 分支名字  #切换到分支
$ git push --set-upstream origin 分支名字 #将分支设为上传分支,同时更新代码到分支
原文地址:https://www.cnblogs.com/ljq1313/p/11426809.html