http://blog.csdn.net/qq_16885135/article/details/52777871

使用 git branch -a 命令可以查http://blog.csdn.net/qq_16885135/article/details/52777871看所有本地分支和远程分支(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. git远程删除分支但本地git branch -a仍能看到解决

    git远程删除分支但本地git branch -a仍能看到解决 在gitlab页面删除分支 但是本地能可以看到 $ git branch -a br_dev br_to_delete * master ...

  2. git远程删除分支后,本地执行git branch -a依然能看到删除分支到底该咋整?

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

  3. git 远程新建分支后,本地查看不到

    使用以下命令同步 git remote # 列出所有远程主机git remote update origin --prune # 更新远程主机origin 整理分支git branch -r # 列出 ...

  4. 使用git批量删除分支

    要删除本地,首先要考虑以下三点 列出所有本地分支 搜索目标分支如:所有含有‘dev’的分支 将搜索出的结果传给删除函数 所以我们可以得到: git br |grep 'dev' |xargs git ...

  5. Git本地仓库与远程github同步的时候提示fatal: remote origin already exists 错误解决办法

    Git本地仓库与远程github同步的时候提示fatal: remote origin already exists 错误解决办法 1.git在本地的电脑创建了仓库,要远程同步github的仓库.使用 ...

  6. windows删除或修改本地Git保存的账号密码

    windows删除或修改本地Git保存的账号密码 学习了:https://blog.csdn.net/xudailong_blog/article/details/78798118 (一)进入控制面板 ...

  7. git pull和git merge区别&&Git冲突:commit your changes or stash them before you can merge. 解决办法

    http://blog.csdn.net/sidely/article/details/40143441 原文: http://www.tech126.com/git-fetch-pull/ Git中 ...

  8. (转)Git冲突:commit your changes or stash them before you can merge. 解决办法

    用git pull来更新代码的时候,遇到了下面的问题: error: Your local changes to the following files would be overwritten by ...

  9. STM32使用cube生成的程序后在keil5编译后首次SWD可以下载再次下载不行的解决办法。

    使用cube配置导出工程在keil5编译后首次SWD下载可以再次下载不行的解决办法. 1原因: cube使用的是HAL库,初始化语句里面禁用了调试功能. 在stm32f1xx_hal_msp.c中 _ ...

随机推荐

  1. Http和RPC区别

    本文转自:https://blog.csdn.net/mou_it/article/details/79873612 RPC(即Remote Procedure Call,远程过程调用)和HTTP(H ...

  2. linux同步Internet时间

    输入ntpdate time.nist.gov同步网络时间 如果未安装:yum install ntpdate 结果:3 Jun 15:42:39 ntpdate[4721]: adjust time ...

  3. phpstorm自定义代码片段

    右上角file--settings--Editor--Live Templates---+

  4. 【python】TCP/IP编程

    No1: [TCP] 客户端 import socket s=socket.socket(socket.AF_INET,socket.SOCK_STREAM) s.connect(('www.sina ...

  5. Python并发复习4- concurrent.futures模块(线程池和进程池)

    Python标准库为我们提供了threading(多线程模块)和multiprocessing(多进程模块).从Python3.2开始,标准库为我们提供了concurrent.futures模块,它提 ...

  6. 项目部署相关命令(pm2)

    普通方式启动后台服务: nohup npm start & 关闭服务,需要找到进程号: lsof -i :3000 kill -9 进程号 通过pm2启动项目,可实现关闭自启动: 安装pm2: ...

  7. OSPF补全计划-2

    想起来几个面试题: 1. OSPF在什么情况下会stuck in Exstart /Exchange状态? 我知道的一个答案是两个端口的mtu不一致.当然整个也不是绝对,因为可以用ip ospf mt ...

  8. C#Stopwatch的简单计时zz

    Stopwatch 类 命名空间:System.Diagnostics.Stopwatch 实例化:Stopwatch getTime=new Stopwatch(); 开始计时:getTime.St ...

  9. PCH 警告:标头停止点不能位于宏或#if块中

    今天在vs2010写了点代码,居然报了“PCH 警告:标头停止点不能位于宏或#if块中”. /********************* * * * 文件夹: ▲01 绪论 * * * * 文件名: ...

  10. mongoDB,mongoose,没有数组就添加,如果有了数组,就向数组中添加新元素

    db.getCollection('photos').findOneAndUpdate("5b028e71f32bd5004f905879",   //findByIdAndUpd ...