利用git终端:创建分支 并推送到远端仓库

创建于: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

3、参考链接

gitee创建自己的仓库并创建新分支

Gitee的分支操作

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

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值