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. I currently have 9 branches with the title patch-1, patch-2... etc... and I'm too lazy to delete them one by one. 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-"
:
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/'`
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.