How to list out the branches which are older than 30 days old in bitbucket

Issue #57 closed
Ashok G created an issue

I want clean the bugfix branches which are older than 30 days , is there any plugin or code snippet for doing this in bitbucket ?

Could you please suggest me how to proceed this ?

BR

Ashok G

Comments (2)

  1. Julius Davies [bit-booster.com] repo owner

    The "branches" page for each repository in Bitbucket has enough information to extract the names of all old branches, and the branches are sorted on that page by "committerDate" (even though that page shows dates based on "authorDate"!). Unfortunately there's now way to reverse the sort so that older branches come first, and so doing things this way could require a lot of clicking.

    If you're comfortable with git command-line, try these two commands in sequence:

    git fetch
    git for-each-ref --format='%(committerdate) %(objectname) %(refname)' --sort=committerdate refs/remotes 
    

    You could combine the commands above with xargs to do some interesting things. More information on this Atlassian Community page: Is there a way to delete branches in bulk?

    p.s. To better understand the difference between committerDate and authorDate, this is a useful command: "git log --pretty=fuller".

  2. Log in to comment