git远程删除分支后,本地执行git branch -a依然能看到删除分支到底该咋整?
使用命令git branch -a
可以查看所有本地分支和远程分支(git branch -r
可以只查看远程分支)
如果发现很多在远程仓库已经删除的分支在本地依然可以看到到底该怎么办呢?(反正强迫症受不了一定要把本地的也同步删除了)
$ git branch -a movtop
task_develop
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依然能看到删除分支到底该咋整?的更多相关文章
- windows 切换git远程仓库地址后 git push 提示Authentication failed
git切换远程分支: 方法一: git remote set-url origin 你新的远程仓库地址 方法二: git remote rm origin git remote add origin ...
- Git远程仓库地址变更本地如何修改
以项目test为例: 老地址:http://192.168.1.1:9797/john/test.git 新地址:http://git.xxx.xxx/john/test.git 远程仓库名称: or ...
- git 远程仓库版本的回退以及git reset 几种常用方式记录
由于 github push 了两个比较潦草的commit, 自己很不满意,又不想重新开vpn进行上传,所以找了一下相关的教程. 最后研究了一下,原理为先在本地还原到你想要的commit,然后强制pu ...
- git远程建立仓库后,将本地项目推到远程报错 fatal: refusing to merge unrelated histories
出现这个问题的最主要原因还是在于本地仓库和远程仓库实际上是独立的两个仓库,假如之前是直接clone的方式在本地仓库就不会有这个问题了. 解决方式是在命令后紧跟 --allow-unrelated-hi ...
- git项目远程地址修改后本地如何处理
今天运维人员为了方便管理,将远程的项目地址给迁移了, 原来是 git@git.lalala.com:yuanlaide/happy.git 变成了 git@git.lalala.com:houlaid ...
- Mac 升级后idea执行git命令报错xcrun: error: invalid active developer path的解决办法
报错 xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun ...
- 创建局域网内远程git仓库,并将本地仓库push推到远程仓库中
转载请注明出处 http://www.goteny.com/articles/2014/06/136.html http://www.cnblogs.com/zjjne/p/3778640.html ...
- git远程分支不显示问题解决
因为项目太大,然后直接git clone拉不下来代码 会报error: RPC failed; HTTP 504 curl 22 The requested URL returned error: 5 ...
- git 代码上传至远程仓库&从远程库克隆到本地
1.下载安装Git.下载:https://git-scm.com/downloads 安装:可参考文章http://blog.csdn.net/zzfenglin/article/details/5 ...
随机推荐
- hbuilder打包集成文件预览
<div class="attachments"> <div class="name">附件</div> <div c ...
- RHEL7网络管理NetworkManager和nmcli指令
1.NetworkManager简介 在 Red Hat Enterprise Linux 7 中,NetworkManager 提供的默认联网服务是一个动态网络控制和配置守护 进程,它尝试在其可用时 ...
- python面向对象、类、socket网络编程
类和对象 python3统一了类与类型的概念:类==类型:从一组对象中提取相似的部分就是类:特征与技能的结合体就叫做对象: 类的功能: 初始实例化: 属性引用: 1.数据属性: 2.函数属性: 对于一 ...
- javac & java
# 没有 package, 没有 import 的情况 * 源文件 public class HelloWorld{ public static void main(String[] args){ S ...
- Android异常与性能优化相关面试问题-冷启动优化面试问题详解
什么是冷启动: 冷启动的定义:冷启动就是在启动应用前,系统中没有该应用的任何进程信息.实际也就是要执行Application.onCreate()方法的那次启动. 冷启动 / 热启动的区别:热启动:用 ...
- python学习笔记-(十三)线程、进程、多线程&多进程
为了方便大家理解下面的知识,可以先看一篇文章:http://www.ruanyifeng.com/blog/2013/04/processes_and_threads.html 线程 1.什么是线程? ...
- jdbc连接数据库方式问题
1.使用service_name,配置方式:jdbc:oracle:thin:@//<host>:1521/net_grid 2.使用SID,配置方式:jdbc:oracle:thin:@ ...
- java中int转成String位数不足前面补零
java中int转成String位数不足前面补零 转载自:http://ych0108.iteye.com/blog/2174134 java中int转String位数不够前面补零 String.fo ...
- Hadoop-No.1之数据存储选型
文件格式 Hadoop支持多种面向数据存储的文件格式,包括纯文本和Hadoop特有的格式,如SequenceFile.还有一些更加复杂但功能更加丰富的格式可供选择,如Avro与Parquet.不同的格 ...
- hdu 6039 Gear Up
题 OvO http://acm.hdu.edu.cn/showproblem.php?pid=6039 (2017 Multi-University Training Contest 1 1007) ...