删除不再位于远程的跟踪分支

本文介绍了如何使用Git命令删除本地不再与远程对应的跟踪分支。通过`git fetch --prune`和`git branch --delete --merged`等命令,可以安全地清理已完成合并并已在远程删除的分支。
摘要由CSDN通过智能技术生成

本文翻译自:Remove tracking branches no longer on remote

Is there a simple way to delete all tracking branches whose remote equivalent no longer exists? 有一种简单的方法可以删除所有不再具有远程等效项的跟踪分支吗?

Example: 例:

Branches (local and remote) 分支机构(本地和远程)

  • master
  • origin/master 起源/主人
  • origin/bug-fix-a 起源/错误修复
  • origin/bug-fix-b 原点/错误修复-b
  • origin/bug-fix-c 原点/错误修复-C

Locally, I only have a master branch. 在本地,我只有一个master分支。 Now I need to work on bug-fix-a , so I check it out, work on it, and push changes to the remote. 现在,我需要处理bug-fix-a ,所以我将其检出,对其进行处理,然后将更改推送到远程计算机。 Next I do the same with bug-fix-b . 接下来,我对bug-fix-b进行同样的操作

Branches (local and remote) 分支机构(本地和远程)

  • master
  • bug-fix-a 错误修复
  • bug-fix-b 错误修复-b
  • origin/master 起源/主人
  • origin/bug-fix-a 起源/错误修复
  • origin/bug-fix-b 原点/错误修复-b
  • origin/bug-fix-c 原点/错误修复-C

Now I have local branches master , bug-fix-a , bug-fix-b . 现在我有了本地分支masterbug-fix-abug-fix-b The Master branch maintainer will merge my changes in

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值