Delete branches in Bitbucket

前端 未结 12 1616
执念已碎
执念已碎 2020-12-22 16:53

I\'ve created lots of branches in one of our repositories. Those branches are for testing before it will be pulled to the master. Now I see lots of them on the list and they

12条回答
  •  清酒与你
    2020-12-22 17:52

    I've wrote this small script when the number of branches in my repo exceeded several hundreds. I did not know about the other methods (with CLI) so I decided to automate it with selenium. It simply opens Bitbucket website, goes to Branches, scrolls down the page to the end and clicks on every branch options menu -> clicks Delete button -> clicks Yes. It can be tuned to keep the last N (100 - default) branches and skip branches with specific names (master, develop - default, could be more). If this fits for you, you can try that way.

    https://github.com/globad/remove-old-branches

    All you need is to clone the repository, download the proper version of Chrome-webdriver, input few constants like URL to your repository and run the script.

    The code is simple enough to understand. If you have any questions, write comments / create an Issue.

提交回复
热议问题