gitee的指定分支

想上传的本地文件夹为C#learning

下面为使用git将这个C#learning上传到项目的example的方法
1.在forup这个文件夹的空白处:鼠标右键 然后选择 Git Bash Here

2.本地仓库初始化,会在此处生成.vs隐藏文件夹
git init

3.其中http://xxxxx.git指gitee处的http(注意结尾有.git)
git remote add origin http://xxxxx.git

4.远程仓库与本地仓库同步
其中example是指远程仓库中的example分支。而本地仓库的分支默认是master,暂时不管,上传时本地分支需要和远程仓库(gitee)的分支同名
git pull origin example
5.将当前目录的全部文件(夹)添加,注意add和 . 之间是有一个空格的
git add .
6.我也忘了这步是干嘛,总之需要这步
git commit -m "这里放一条备注"
7.这步将本地仓库的master上传到之前同步的远程仓库中,但是!!!因为我们的目标的远程仓库(gitee)的分支是example,而本地仓库默认是master
git push origin master
***这步不要写!!!***

7.1创建本地分支
git vranch example
7.2切换分支
git checkout example

7.3与远程分支相关联(其实第3步就已经关联了,所以如果做了第三步这一步可以不用。)
git remote add origin http://xxxxx.git

7.4将本地仓库的仓库上传,远程仓库的分支与本地仓库的分支同名
git push origin example
这样就好了
常见两个错误
1.Unable to access ‘https://gitee.com/自己的项目/': Could not resolve host: gitee.com
参考在Git的etc的hosts里添加ip github.com就好了
2.还有一个错误记得是出现在git push origin 本地分支 的时候,大概意思是不能上传 src refspec 分支名字 does not match any
参考创建分支
方便记忆的思维导图总结

总结
到此这篇关于git 将本地文件(夹)上传到gitee指定分支的处理方法的文章就介绍到这了,更多相关git上传本地文件到gitee上 内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
您可能感兴趣的文章:- 详解Git合并分支的流程步骤
- git的远程分支的作用和本地分支有什么区别
- git push 本地项目推送到远程分支的方法(git命令版)
- idea手动刷新git分支的详细教程
- Git命令之分支详解