Removal of merged branches


(K-T Lim) #1

After the adoption of RFC-514, merged branches that are named in the merge commit comment can be removed. Developers should feel free to do this for all merges going forward.

I have written a script that will find and remove only branches that are so named; that are merged to master, next (an integration branch from a previous workflow), or draft (an integration branch for documents from a previous workflow); and that have had no commits since their merge. I am going to execute this script on the repositories in the lsst and lsst-dm GitHub orgs.

Local clones will not be affected until you do a git fetch --prune.

We anticipate that this will improve the usefulness of aspects of the git and GitHub UIs pertaining to branches and will improve the performance of the Jira/GitHub integration.

By the nature of the removal, it is easy to re-create a branch that needs to be retained for some other reason: git checkout -b $BRANCH HEAD^{/Merge.*$BRANCH}^2


(John Parejko) #2

Do branches that are merged with the default message that appears via the “Big Green Button” fall under this, or do we have to modify said default message?


(K-T Lim) #3

The default “big green button” message is sufficient. But the button is not always safe to push. It is only safe if the branch has been rebased on master and master has not changed in the meantime, which can be guaranteed by having appropriate branch protections and status checks configured.

See https://developer.lsst.io/stack/adding-a-new-package.html#configuring-github-repositories and note that, as of this writing, an actual status check of some kind must be enabled for “require that branches be up to date before merging” to take effect.