创建于:20200730
修改于:20200730、20200918
如何首次创建gitee并上传,请参考:win10环境下,首次上传本地代码到gitee(码云)
1、背景
代码到了一定的程度,想建立一个分支,确定下来。决定在gitee的一个代码仓库中,创建一个分支。
2、具体过程
在相应目录下,右击,选择Git Bash Here
#(1)在本地新建一个分支
git branch test_branch
#(2)切换到你的新分支
git checkout test_branch
#(3)将新分支发布在github上,这时候提示输入账号名和密码
git push origin test_branch
# 删除远程分支
git push origin --delete test_branch
# 删除本地分支
git branch --delete test_branch
具体流程及显示如下
xx@yy MINGW64 /d/programs/Anaconda_program/EnterpriseElectricityHealthIndex (master)
$ git branch test_branch
xx@yy MINGW64 /d/programs/Anaconda_program/EnterpriseElectricityHealthIndex (master)
$ git checkout test_branch
Switched to branch 'test_branch'
M .idea/EnterpriseElectricityHealthIndex.iml
A .idea/vcs.xml
M .idea/workspace.xml
M model_cal.py
xx@yy MINGW64 /d/programs/Anaconda_program/EnterpriseElectricityHealthIndex (test_branch)
$ git push origin test_branch
Total 0 (delta 0), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-5.0]
remote: Create a pull request for 'test_branch' on Gitee by visiting:
remote: https://gitee.com/cccc/EnterpriseElectricityHealthIndex/pull/new/cccc:test_branch...cccc:master
To https://gitee.com/cccc/EnterpriseElectricityHealthIndex
* [new branch] test_branch -> test_branch
xx@yy MINGW64 /d/programs/Anaconda_program/EnterpriseElectricityHealthIndex (test_branch)
$ git push origin :test_branch
remote: Powered by GITEE.COM [GNK-5.0]
To https://gitee.com/cccc/EnterpriseElectricityHealthIndex
- [deleted] test_branch
xx@yy MINGW64 /d/programs/Anaconda_program/EnterpriseElectricityHealthIndex (test_branch)
$
此时,已经把本地的文件上传到新建的test_branch分支上了。
切换到master上: git branch master