Skip to content

Feature Request: Delete remote merged branches #137

@mcico

Description

@mcico

Hey,

I started to use git-trim to cleanup my local git repositories and replaced my one line script with it. I work for a company where we use Bitbucket and developers work on many different projects over time.

By default Bitbucket does not delete the branches of merged pull requests which results in many branches on the Bitbucket server nobody needs anymore. Among the merged branches there are some that were not yet merged or have commits that were not yet merged to the master branch. Sometimes these commits are irrelevant, but sometimes they commit review feedback that was forgotten. Unfortunately the Bitbucket UI incapable of filtering branches based on a branch state like 'merged'.

I think it helps to get rid of merged branches because they do not contain additional information and instead clutter the list of branches. Instead it would be nice to have a list of branches that need attention. As of now I use a one liner to delete remote branches which suffers from the same problems as the one to cleanup local branches
git branch -r --merged | egrep -v '(master|release)' | sed 's|origin/||g' | xargs -n 1 git push --delete origin

Is this something that would fit the use cases of git-trim?

cheers & thanks
Marco

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions