使用命令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. c#传入类名插入多条数据

    public int Insert<T>(IReadOnlyCollection<T> models) where T : class, new() { int sucess ...

  2. iptables实现内外网端口映射及转发上网

    前两天在工作中遇到一个需求,某192.168.1.0/24内网网段内只有一台主机A连接到了公网,A的两块网卡分别有一个公网地址(123.234.345.456)和一个内网地址(192.168.1.10 ...

  3. BLE 5协议栈-链路层

    文章转载自:http://www.sunyouqun.com/2017/04/page/3/ 链路层LL(Link Layer)是协议栈中最重要的一层. 链路层的核心是状态机,包含广播.扫描.发起和连 ...

  4. [ZOJ 3076] Break Standard Weight

    题目连接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5009 题意:给你两个数字,可以把其中一个拆成两个数字,计算这三个数字 ...

  5. Android异常与性能优化相关面试问题-ANR异常面试问题详解

    什么是ANR? Application Not Responding 造成ANR的主要原因: 应用程序的响应性是由ActivityManager和WindowManager系统服务监视的,当监视到在A ...

  6. [易学易懂系列|rustlang语言|零基础|快速入门|(22)|宏Macro]

    [易学易懂系列|rustlang语言|零基础|快速入门|(22)|宏Macro] 实用知识 宏Macro 我们今天来讲讲Rust中强大的宏Macro. Rust的宏macro是实现元编程的强大工具. ...

  7. 流媒体服务器搭建 red5

    简介 1. 流媒体指以流方式在网络中传送音频.视频和多媒体文件的媒体形式.相对于下载后观看的网络播放形式而言,流媒体的典型特征是把连续的音频和视频信息压缩后放到网络服务器上,用户边下载边观看,而不必等 ...

  8. SSM框架中使用日志框架

    在 pom,xml 配置 Log4j jar 添加一个 mybatis_log.xml 文件 完整配置信息 <?xml version="1.0" encoding=&quo ...

  9. 灰度图像--图像增强 双边滤波 Bilateral Filtering

    学习DIP第31天 转载请标明本文出处:http://blog.csdn.net/tonyshengtan,欢迎大家转载,发现博客被某些论坛转载后,图像无法正常显示,无法正常表达本人观点,对此表示很不 ...

  10. curl: (35) Server aborted the SSL handshake 解决办法

    # 先删除curl brew uninstall curl # 重新安装curl,带上--with-openssl brew install curl --with-openssl # 然后重启下ph ...