【错误记录】Git 使用报错 ( git branch -a 仍能查询到已经删除的远程分支 )
文章目录
- 一、报错信息
- 二、解决方案
一、报错信息
之前已经执行
git push origin --delete feature1
命令 , 删除了 feature1 远程分支 , 删除操作成功 , 远程仓库中 , 只剩下 master 主分支 ;
远程仓库分支如下图 :
执行
git branch
进行本地版本库分支查询 , 本地只有 master 分支 ;
然后再执行
gir branch -a
查询远程分支 , 发现仍然能查询到 remotes/origin/feature1
远程分支 ;
D:\Git\git-learning-course>git branch -a
* masterremotes/origin/HEAD -> origin/masterremotes/origin/feature1remotes/origin/master
注意 , 此时再执行 git push origin --delete feature1
命令 , 是无用的 , 只会提示错误信息 ;
二、解决方案
执行
git remote show origin
命令 , 可以列出在本地分支中对应的远程分支 , 也就是本地分支执行 git push
命令 , 代码会被推送到哪个远程分支 ;
D:\Git\git-learning-course>git remote show origin
warning: redirecting to https://codechina.csdn.net/han12020121/git-learning-course.git/
* remote originFetch URL: https://codechina.csdn.net/han12020121/git-learning-coursePush URL: https://codechina.csdn.net/han12020121/git-learning-courseHEAD branch: masterRemote branches:master trackedrefs/remotes/origin/feature1 stale (use 'git remote prune' to remove)Local branch configured for 'git pull':master merges with remote masterLocal ref configured for 'git push':master pushes to master (up to date)
然后 , 执行
git remote prune origin
命令 , 可以同步本地远程分支 , 也就是删除 feature1 分支 ;
D:\Git\git-learning-course>git remote prune origin
warning: redirecting to https://codechina.csdn.net/han12020121/git-learning-course.git/
Pruning origin
URL: https://codechina.csdn.net/han12020121/git-learning-course* [pruned] origin/feature1
最后 , 再次执行
git branch -a
命令 , 查询远程分支 , 发现只剩下 master 主分支了 ;
D:\Git\git-learning-course>git branch -a
* masterremotes/origin/HEAD -> origin/masterremotes/origin/master
【错误记录】Git 使用报错 ( git branch -a 仍能查询到已经删除的远程分支 )相关推荐
- 【错误记录】Git 使用报错 ( git: ‘switch‘ is not a git command. See ‘git --help‘. )
文章目录 一.报错信息 二.解决方案 一.报错信息 执行 git switch -c feature1 命令 , 创建分支 , 报如下错误 : D:\Git\git-learning-course&g ...
- git使用报错:fatal: Couldn't find remote ref master的解决方法
git使用报错:fatal: Couldn't find remote ref master的解决方法 fatal: Couldn't find remote ref master 翻译过来就是:致命 ...
- git使用报错: fatal: Couldn‘t find remote ref master的解决方法
git使用报错: fatal: Couldn't find remote ref master的解决方法 参考文章: (1)git使用报错: fatal: Couldn't find remote r ...
- git使用报错:fatal: Couldn‘t find remote ref master的解决方法
git使用报错:fatal: Couldn't find remote ref master的解决方法 参考文章: (1)git使用报错:fatal: Couldn't find remote ref ...
- 【错误记录】Git 使用报错 ( error: The branch ‘feature1‘ is not fully merged. )
文章目录 一.报错信息 二.解决方案 一.报错信息 执行 git branch -d feature1 命令 , 删除 feature1 分支 , 报如下错误 : D:\Git\git-learnin ...
- 【错误记录】Git 使用报错 ( error: Cannot delete branch ‘dev‘ checked out at ‘D:/Git/git-learning-course‘)
文章目录 一.报错信息 二.解决方案 一.报错信息 使用 Git 操作 版本库 , 删除分支时 , 报如下错误 : D:\Git\git-learning-course>git branch - ...
- 【错误记录】Git 使用报错 ( no changes added to commit (use “git add“ and/or “git commit -a“) )
文章目录 一.报错信息 二.解决方案 一.报错信息 修改了 Git 版本库中的 file1.txt 文件 , 直接执行 git commit -m "modify file1" 命 ...
- 日常开发中,你需要掌握的git使用报错解决
1.不允许将代码推送到该项目上受保护的分支 - 问题发生: remote: GitLab: You are not allowed to push code to protected branches ...
- git 使用报错 [rejected] master -> master (fetch first)(non-fast forward)
git 使用中的bug RT ! [rejected] master -> master (fetch first) 在将数据push到gitee仓库上出现这个错误,原因:没有同步gitee上的 ...
最新文章
- 1042. 托普利兹矩阵
- PHP之MVC项目实战(二)
- 【NIPS2018】Spotlight及Oral论文汇总
- python炒股日记_自学python的日记分享
- WWW2022 | 知识提示的预训练微调
- 用python重温统计学基础:描述性统计分析
- 【muduo】TcpClient与TcpServer建立连接过程对比
- 概率论与数理统计 | (16) 方差分析与一元线性回归
- 常见cpu性能优化方法
- UFS Host Controller工作流程
- 简历中的工作经历怎么写?
- HashMap非线程安全问题
- THUPC 2019 CTS 2019 打铁记
- 自制 计算机主板,三步教你如何DIY电脑主板和CPU的搭配
- MSDC 4.3 接口规范(30)
- 友价商城2019.2月最新版
- 微信小程序view控件自动换行
- BGP协议:简介、属性、选路原则
- 中冠百年|家庭中短期理财攻略
- 【OpenMMLab AI实战营 学习笔记 DAY(四)-- 目标检测基础知识及评估方法】