Branch Cleanup Improvements

Description

After your team uses Gitlab for a while your repo is littered with unused and abandoned branches. Occasionally there are naming conflicts or similarly-named branches, or a team member may pull an old branch instead of the one you asked him/her to pull.

Proposal

It would be helpful if non-protected branches older than a certain threshold could be automatically deleted.

  • The project owner or admin should be able to control when branches expire (i.e., 8 months).
  • The actual branch deletion could be performed in the background.

For Reference...

Here is how I do it from the command line now. It's not pretty:

for branch in `git branch -r | grep -v HEAD`; do echo -e `git show --format="%cr %an" $branch | head -n 1` \\t$branch; done | grep -e '.. months' -e '[8-9] months' | grep 'origin/' | sed 's/.*origin\///' | xargs -n 1 echo git push origin --delete | bash

~"feature proposal"

Assignee Loading
Time tracking Loading