git remote prune origin删除本地有但在远程库已经不存在的分支

原文:删除在本地有但在远程库中已经不存在的分支

 

 

版权声明:本文为博主原创文章,未经博主允许不得转载。

上篇 讲到用

 

[plain] view plain copy

 在CODE上查看代码片派生到我的代码片

  1. $ git remote show origin  


可以查看远程库的一些信息,及与本地分支的信息。有时候可能遇到如下情况

 

 

[plain] view plain copy

 在CODE上查看代码片派生到我的代码片

  1. $ git remote show origin  
  2.   
  3. * remote origin  
  4.   Fetch URL: ... .git  
  5.   Push  URL: ... .git  
  6.   HEAD branch: master  
  7.   Remote branches:  
  8.     dev                     tracked  
  9.     jqmobi                  tracked  
  10.     master                  tracked  
  11.     refs/remotes/origin/3.1 stale (use 'git remote prune' to remove)  
  12.     refs/remotes/origin/tc  stale (use 'git remote prune' to remove)  
  13.     refs/remotes/origin/xhl stale (use 'git remote prune' to remove)  
  14.   Local branches configured for 'git pull':  
  15.     dev    merges with remote dev  
  16.     master merges with remote master  
  17.   Local refs configured for 'git push':  
  18.     dev    pushes to dev    (up to date)  
  19.     jqmobi pushes to jqmobi (up to date)  
  20.     master pushes to master (up to date)  

 

其中3.1, tc, xhl三个分支在远程库已经不存在了(你之前从远程库拉取过,可能之后被其他人删除了,你用 Git branch -a 也是不能看出它们是否已被删除的),这时候我们可以删除本地库中这些相比较远程库中已经不存在的分支:

 

 

[plain] view plain copy

 在CODE上查看代码片派生到我的代码片

  1. $ git remote prune origin  
  2. Password for '...':  
  3. Pruning origin  
  4. URL: ... .git  
  5.  * [pruned] origin/3.1  
  6.  * [pruned] origin/tc  
  7.  * [pruned] origin/xhl  

 

原文地址:https://blog.csdn.net/yzpbright/article/details/53491069

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值