使用命令git branch -a可以查看所有本地分支和远程分支(git branch -r 可以只查看远程分支) 
如果发现很多在远程仓库已经删除的分支在本地依然可以看到到底该怎么办呢?(反正强迫症受不了一定要把本地的也同步删除了)

$ git branch -a

  movtop
task_develop
* weibo
remotes/origin/HEAD -> origin/task_develop
remotes/origin/develop
remotes/origin/fix_composer_repositories_type
remotes/origin/join_weixin_module
remotes/origin/master
remotes/origin/mining-backup
remotes/origin/movtop
remotes/origin/right
remotes/origin/schedule_dev
remotes/origin/stuff_web_fix
remotes/origin/task_develop
remotes/origin/task_idea
remotes/origin/task_temp
remotes/origin/task_yqj
remotes/origin/weibo
remotes/origin/weixin_temp

使用命令 git remote show origin可以查看remote地址,远程分支,还有本地分支与之相对应关系等信息。

$ git remote show origin  

* remote origin
Fetch URL: https://xxx@gitlab.com/xxx/xxx.git
Push URL: https://xxx@gitlab.com/xxx/xxx.git
HEAD branch: task_develop
Remote branches:
master tracked
mining-backup tracked
refs/remotes/origin/develop stale (use 'git remote prune' to remove)
refs/remotes/origin/fix_composer_repositories_type stale (use 'git remote prune' to remove)
refs/remotes/origin/join_weixin_module stale (use 'git remote prune' to remove)
refs/remotes/origin/movtop stale (use 'git remote prune' to remove)
refs/remotes/origin/right stale (use 'git remote prune' to remove)
refs/remotes/origin/schedule_dev stale (use 'git remote prune' to remove)
refs/remotes/origin/stuff_web_fix stale (use 'git remote prune' to remove)
refs/remotes/origin/task_temp stale (use 'git remote prune' to remove)
refs/remotes/origin/weibo stale (use 'git remote prune' to remove)
task_develop tracked
task_idea tracked
task_yqj tracked
weixin_temp tracked
Local branches configured for 'git pull':
movtop merges with remote movtop
task_develop merges with remote task_develop
weibo merges with remote weibo
Local ref configured for 'git push':
task_develop pushes to task_develop (up to date)

此时我们可以看到那些远程仓库已经不存在的分支,根据提示,使用 git remote prune origin 命令:

$ git remote prune origin

Pruning origin
URL: https://xxx@gitlab.com/xxx/xxx.git
* [pruned] origin/develop
* [pruned] origin/fix_composer_repositories_type
* [pruned] origin/join_weixin_module
* [pruned] origin/movtop
* [pruned] origin/right
* [pruned] origin/schedule_dev
* [pruned] origin/stuff_web_fix
* [pruned] origin/task_temp
* [pruned] origin/weibo

这样就删除了那些远程仓库不存在的分支。

git远程删除分支后,本地执行git branch -a依然能看到删除分支到底该咋整?的更多相关文章

  1. windows 切换git远程仓库地址后 git push 提示Authentication failed

    git切换远程分支: 方法一: git remote set-url origin 你新的远程仓库地址 方法二: git remote rm origin git remote add origin ...

  2. Git远程仓库地址变更本地如何修改

    以项目test为例: 老地址:http://192.168.1.1:9797/john/test.git 新地址:http://git.xxx.xxx/john/test.git 远程仓库名称: or ...

  3. git 远程仓库版本的回退以及git reset 几种常用方式记录

    由于 github push 了两个比较潦草的commit, 自己很不满意,又不想重新开vpn进行上传,所以找了一下相关的教程. 最后研究了一下,原理为先在本地还原到你想要的commit,然后强制pu ...

  4. git远程建立仓库后,将本地项目推到远程报错 fatal: refusing to merge unrelated histories

    出现这个问题的最主要原因还是在于本地仓库和远程仓库实际上是独立的两个仓库,假如之前是直接clone的方式在本地仓库就不会有这个问题了. 解决方式是在命令后紧跟 --allow-unrelated-hi ...

  5. git项目远程地址修改后本地如何处理

    今天运维人员为了方便管理,将远程的项目地址给迁移了, 原来是 git@git.lalala.com:yuanlaide/happy.git 变成了 git@git.lalala.com:houlaid ...

  6. Mac 升级后idea执行git命令报错xcrun: error: invalid active developer path的解决办法

    报错 xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun ...

  7. 创建局域网内远程git仓库,并将本地仓库push推到远程仓库中

    转载请注明出处 http://www.goteny.com/articles/2014/06/136.html http://www.cnblogs.com/zjjne/p/3778640.html ...

  8. git远程分支不显示问题解决

    因为项目太大,然后直接git clone拉不下来代码 会报error: RPC failed; HTTP 504 curl 22 The requested URL returned error: 5 ...

  9. git 代码上传至远程仓库&从远程库克隆到本地

    1.下载安装Git.下载:https://git-scm.com/downloads  安装:可参考文章http://blog.csdn.net/zzfenglin/article/details/5 ...

随机推荐

  1. centos7 搭建pxe 安装centos windows(非全自动)(这个教程测试centos6和7.2可以用,Windows各版本也可以)

    yum install dhcp xinetd syslinux tftp-server httpd 编辑dhcpdb配置(192.168.0.1为本机IP) ; max-lease-time ; l ...

  2. API开发之接口安全(一)----生成sign

    在对于API的开发中 最让人头疼的 就是接口数据暴露 让一些有心之人 抓包之后恶意请求 那么如何解决这一弊端呢?自然而然的 我们就想到了 加密  那我们又如何加密 如何解密 才能使之有最安全的效率呢? ...

  3. 制作自定义系统iso镜像

    一.制作自己的ISO启动盘篇 在需要安装特定系统的时候,我们使用原版的linux系统盘镜像来安装,需要手动操作N多步,在机器非常多的环境下,这种方式显然不理想,这是我我们就需要制作我们特定的系统盘来简 ...

  4. five rendering ideas 里获取csm的 shadow边界做 pcf

    http://advances.realtimerendering.com/s2011/White,%20BarreBrisebois-%20Rendering%20in%20BF3%20(Siggr ...

  5. 使用 Drag and Drop 给Web应用提升交互体验

    什么是 Drag and Drop (拖放)? 简单来说,HTML5 提供了 Drag and Drop API,允许用户用鼠标选中一个可拖动元素,移动鼠标拖放到一个可放置到元素的过程. 我相信每个人 ...

  6. TXNLP 33-40

    词向量: 回顾基于检索的问答系统 倒排表解决:坑爹的翻译...应该翻译成“反向索引” 常规的索引是文档到关键词的映射: 文档——>关键词但是这样检索关键词的时候很费力,要一个文档一个文档的遍历一 ...

  7. Hive中将文件加载到数据库表失败解决办法

    Hive中将文件加载到数据库表失败解决办法(hive创建表失败) 遇到的问题: FAILED: Execution Error, return code 1 from org.apache.hadoo ...

  8. npm报错 This is probably not a problem with npm,there is likely additional logging output above可能的原因

    npm WARN Local package.json exists, but node_modules missing, did you mean to install? 解决方法: 输入npm i ...

  9. ThreadPoolTaskExecutor使用详解(转)

    当并发或者异步操作,都会用到ThreadPoolTaskExecutor.现在对线程池稍作理解. /*** *@Auth dzb *@Date 22:29 2018/8/29 *@Descriptio ...

  10. Liquibase使用(转)

    文章目录 介绍快速使用Springboot中引入依赖配置日志文件ChangeLog编写变更记录ChangeSetMaven中引入依赖配置liquibase.properties编写变更记录Change ...