git 新建分支并提交本地代码到远程分支

step1,在本地新建分支

git branch newbranch

step2:把本地分支push到远程

git push origin newbranch

step3:切换到该分支

git checkout newbranch

step4:查看本地修改

git status

step5:添加本地修改

git add .

step6:commit修改

git commit -m 'XXXX'

step7:push代码

git push origin newbranch

完毕

git基于某个分支创建分支

1、拷贝源代码

git clone git地址

cd 项目目录

2、根据已有分支创建新的分支

git checkout -b newbranchname origin/oldbranchname

3、推送到git

git push origin newbranchname

猜你喜欢

转载自blog.csdn.net/whuzhang16/article/details/109546230