[英]How do I automatically delete all the github generated patch branches from a fork
Every time I make typo corrections when reading other people's github repositories, a branch is created in my repository and they pile up because I never return to the pull request to delete them. 每当我在阅读其他人的github存储库时进行错字更正时,都会在我的存储库中创建一个分支,并且它们会堆积起来,因为我从未返回过pull请求来删除它们。 I currently have 9 branches with the title patch-1, patch-2... etc... and I'm too lazy to delete them one by one.
我目前有9个分支,标题分别为patch-1,patch-2 ...等...,而且我懒得一一删除。 How can I automatically delete them?
如何自动删除它们?
If you just need a general script that will delete all merged branches (either locally or remotely, I have a utility script to do just that). 如果您只需要一个通用脚本即可删除所有合并的分支(本地或远程,我可以使用实用程序脚本来执行此操作)。 To delete all local branches that have been merged:
要删除所有已合并的本地分支:
git-delete-merged --doit --local
To delete all remote branches on origin
matching the regex "patch-"
: 要删除与正则表达式
"patch-"
匹配的origin
上的所有远程分支:
git delete-merged --remote origin --match "patch-" --doit
If you don't want to add a script for a one-off need you can find what you need for a specific one-liner in the source. 如果您不想为一次性需求添加脚本,则可以在源代码中找到特定的一线需求。
使用我写的以下命令:
git push --delete origin `git branch -r --list 'origin/patch*' | sed 's/origin\/\(.*\)/\1/'`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.