删除混帐多个远程分支机构 [英] Delete multiple remote branches in git
本文介绍了删除混帐多个远程分支机构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无意中谁推了他的地方分支机构的150至我们的中央回购团队成员。值得庆幸的是,它们都具有相同的preFIX。使用preFIX,有一个Git命令或者很酷的小shell脚本,我可以使用,将删除所有这些一次?
I have a team member who inadvertently pushed over 150 of his local branches to our central repo. Thankfully, they all have the same prefix. Using that prefix, is there a git command or cool little shell script I can use that will delete all of those at once?
推荐答案
使用下面的命令来删除远程服务器上以 preFIX
preFIX所有分支机构
Use the following command to remove all branches with PREFIX
prefix on remote server.
git branch -r | awk -F/ '/\/PREFIX/{print $2}' | xargs -I {} git push origin :{}
您可能希望做一个干先运行,看它是否是您要删除的分支:
You may want to do a dry-run first to see if it is the branches that you want to remove:
git branch -r | awk -F/ '/\/PREFIX/{print $2}'
这篇关于删除混帐多个远程分支机构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文