最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

git - How to delete old patches to open-source project? - Stack Overflow

programmeradmin1浏览0评论

I've been contributing to a project for many years. I've made hundreds of PRs on github via the browser. I've noticed now that I have many many patch branches and would like to clean these up. I've tried with git bash, but I'm failing to understand it. Example: This PR was merged and I have the option at the bottom to "Delete branch". How can I do that with all merged patches?

I've been contributing to a project for many years. I've made hundreds of PRs on github via the browser. I've noticed now that I have many many patch branches and would like to clean these up. I've tried with git bash, but I'm failing to understand it. Example: https://github/citation-style-language/styles/pull/7476 This PR was merged and I have the option at the bottom to "Delete branch". How can I do that with all merged patches?

Share Improve this question asked Mar 18 at 9:45 POBrien333POBrien333 234 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

If you only use the GitHub website: Go to your fork, then click on "XX branches" above the file list. Then select the "Active" tab and start deleting your branches one by one from there.

If you have a local Git clone of the repository: Use git push to delete a branch from the remote repository.

For example:

git push --delete myfork patch-743604 patch-12345 patch-23456

To mass-delete all patch-* branches (first with -vn for a "dry run" to verify that it's going to do the correct thing, then without -vn to actually do it):

git ls-remote origin | awk '{print $2}' | grep ^refs/heads/patch- | xargs git push -vn --delete myfork

Alternative syntax (using local:remote to push "nothing"):

git push myfork :patch-743604 :patch-12345 :patch-23456
发布评论

评论列表(0)

  1. 暂无评论