Late last year, Drupal.org enabled Gitlab-based merge requests for all projects. Instead of the typical patch-based workflow, each issue can have its own fork, with any number of branches and merge requests (MRs).
Because each issue’s branches live in a different fork, this leads to many, many git remotes in your local repo. Over time, as those MRs are merged or closed, there’s not a straightforward way to close them all.
At first I wrote a script that directly checked for any of the fixed/closed statuses, and ran
git remote remove for each of them. But that was rather scary. My next iteration instead printed out the
git remote remove command for each fork.
But as I looked at it more, I decided it would be nice to simply print out all the remotes, grouped by their status. This way you can make your own decisions on what to do with the leftover ones:
$ git remote-status Needs work: drupal-3111192 Needs review: drupal-2935999 drupal-3025231 drupal-3164389
As always, any improvements are welcome!