从git创建新分支后推送数据同步新的分支

从git创建分支后推送数据同步新的分支

  1. 创建分支
bash 复制代码
 git branch yzm ----创建git 分支
  1. 查看分支情况
bash 复制代码
 git branch----查看git 分支
  1. 选择进入的分支
bash 复制代码
git checkout yzm----选择git分支

4.推送数据

存在问题(这个分支只在本地,远程gitee仓库不存在,要就要进行,同步创建分支)

bash 复制代码
 git push   --推送 会报错
 //fatal: The current branch yzm has no upstream branch.---因为远程没有这个分支
  1. 解决
bash 复制代码
 git push --set-upstream origin yzm----使用创建同步分支和推送
bash 复制代码
PS C:\Users\84961\Desktop\htmlknow> git branch yzm----创建git 分支
PS C:\Users\84961\Desktop\htmlknow> git branch----查看git 分支
* master
  yzm
PS C:\Users\84961\Desktop\htmlknow> git checkout yzm----选择git分支
Switched to branch 'yzm'
PS C:\Users\84961\Desktop\htmlknow> git branch      
  master
* yzm
PS C:\Users\84961\Desktop\htmlknow> git add . ---暂存数据
PS C:\Users\84961\Desktop\htmlknow> git push   --推送
fatal: The current branch yzm has no upstream branch.---因为远程没有这个分支
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin yzm----使用创建和推送

To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.

PS C:\Users\84961\Desktop\htmlknow> git push --set-upstream origin yzm ----推送和创建分支
 * [new branch]      yzm -> yzm
branch 'yzm' set up to track 'origin/yzm'.
PS C:\Users\84961\Desktop\htmlknow> 
相关推荐
Winlifes4 天前
我给 Codex 做了一个 Git 面板:分支树、提交历史和工作区操作
git
郑州光合科技余经理4 天前
同城外卖小程序开发:下单成功后,后台导出能不能对上用户端状态
开发语言·前端·git·后端·uni-app·php·ai编程
我命由我123454 天前
Git 推送报错:error: src refspec main does not match any
运维·git·gitee·github·运维开发·学习方法·版本控制
Lcr3s5 天前
Git基础之(0):如何在Ubuntu(Linux)上安装git
git
玄芯散人5 天前
【筑基·058】Git协作工作流:冲突解决和PR流程
git·版本控制·团队协作
寺中人6 天前
Git 版本控制完全入门指南:从安装到实战,提交 + 分支 + 协作 + 冲突解决全拆解
git·开发工具·版本控制·团队协作·代码管理
荔枝梅梅6 天前
新手程序员 SSH 第一课:从 Git 仓库连接失败理解 SSH 协议与密钥配置
git
玄芯散人6 天前
【筑基·057】Git代码时光机:版本控制入门到分支管理
git·版本控制·嵌入式开发
szephyr6 天前
Git 分支管理实战:feature/release/hotfix 怎么用才不乱
git·分支管理·团队协作·工作流·hotfix
一木 之林6 天前
手搓家庭服务器:二手装机、Docker部署、端口映射与frp内网穿透
服务器·人工智能·git·编辑器