如何删除所有已经集成的远程git分支? [英] How to delete all remote git branches which have already been integrated?

查看:128
本文介绍了如何删除所有已经集成的远程git分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在工作中,我们正在使用主题分支,这些主题分支在某些时候被集成到几个主分支中。
现在我想从我的 remote 存储库中删除已完全集成到主分支中的所有主题分支。如果这是不可能的,检索已整合的本地分支机构清单也可以。

编辑:



最佳答案来自skalee的评论:

  git branch -a --merged remotes / origin / master | grep -v master | grepremotes / origin /| cut -d/-f 3- | xargs -n 1 git push  - 删除来源

旧回答:

  git push --delete远程topicbranch 



$或b
$ b $ pre $ g $ git push remote:topicbranch

给出一个分支列表,可能是 git branch --merged master


At work we are using topic branches which are integrated into a few (3) master branches at some point. Now I'd like to delete all topic branches from my remote repository which have been fully integrated into a master branch. If that's not possible, retrieving a list of local branches which have been integrated would be fine, too.

解决方案

Edit:

Best answer from skalee's comment:

git branch -a --merged remotes/origin/master | grep -v master | grep "remotes/origin/" | cut -d "/" -f 3- | xargs -n 1 git push --delete origin

Old answer:

git push --delete remote topicbranch

or

git push remote :topicbranch

Giving a list of branches, would be something with git branch --merged master

这篇关于如何删除所有已经集成的远程git分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆