Git切换分支并提交到远程分支


1. 在本地需要提交的文件同级目录运行git bash

2. 初始化 git 运行环境

$ git init

3. 新建本地分支develop

$ git checkout -b decelop

4. 链接远程仓库

$ git remote add origin remote_address   

5. 同步远程仓库信息

$ git pull

 

6. 关联本地仓库与远程仓库

$ git branch --set-upstream-to=origin/develop develop

7. 若遇报错: branch 'develop' does not exist

则运行如下指令:

$ git pull origin branch --allow-unrelated-histories
$ git branch --set-upstream-to=origin/develop develop

8. 查看当前分支跟踪的远程分支

$ git branch -vv

9. 同步远程分支

$ git pull

 

10. 提交修改到远程分支

$ git add .
$ git commit -m "modify description"
$ git push

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM