Preventing Recreation of Master Branch



Request for GitHub to prevent re-creation of Master branch

Proposal

We completed our analysis of the GitHub native renaming tool.Ā  You can see my full set notes and evaluation criteria atĀ https://samvera.atlassian.net/wiki/x/AYBcJg .Ā  There are only two major pieces of feedback I would like to provide.

Ā 

-----------------------------------

Able to recreate master

-----------------------------------

The biggest concern we have is that the master branch can be republished to GitHub which has the potential to cause a lot of problems in such a large community with many committers.Ā  There can be confusion with new PRs set to merge in to the republished master branch.

Ā 

Something GitHub can do that would give us the tools we need to prevent this is to add an option to block creation of branches that match the ā€˜masterā€™ pattern.Ā  For example, the process could beā€¦

Ā 

  • Create new branch rule at Ā Settings -> Branches -> Add rule

  • Branch name pattern: master

  • Under Rules applied to everyone including administrators, add rule ā€˜Block creationā€™ with description something like ā€˜Do not allow branches with the matching pattern to be published to GitHub.ā€™

Ā 

-----------------------------------

Forwarding of missing to renamed branch

-----------------------------------

This is less important if the first area is addressed.Ā  What I noticed is that after the rename, all URLs that are directed to master were forwarded to the same path under the main branch.Ā  This is great.Ā Ā 

Ā 

The problem comes in if a branch with the old name is created.Ā  The forwarding no longer happens.Ā  This is understandable and in some scenarios might even be desirable.Ā  But it is again a potential pitfall when working in a large community.Ā  If we are able to block the creation of certain branches, this would not pose a significant problem.

Ā 

We completed our analysis of the GitHub native renaming tool.Ā  You can see my full set notes and evaluation criteria atĀ https://samvera.atlassian.net/wiki/x/AYBcJg .Ā  There are only two major pieces of feedback I would like to provide.

Ā 

-----------------------------------

Able to recreate master

-----------------------------------

The biggest concern we have is that the master branch can be republished to GitHub which has the potential to cause a lot of problems in such a large community with many committers.Ā  There can be confusion with new PRs set to merge in to the republished master branch.

Ā 

Something GitHub can do that would give us the tools we need to prevent this is to add an option to block creation of branches that match the ā€˜masterā€™ pattern.Ā  For example, the process could beā€¦

Ā 

  • Create new branch rule at Ā Settings -> Branches -> Add rule

  • Branch name pattern: master

  • Under Rules applied to everyone including administrators, add rule ā€˜Block creationā€™ with description something like ā€˜Do not allow branches with the matching pattern to be published to GitHub.ā€™

Ā 

-----------------------------------

Forwarding of missing to renamed branch

-----------------------------------

This is less important if the first area is addressed.Ā  What I noticed is that after the rename, all URLs that are directed to master were forwarded to the same path under the main branch.Ā  This is great.Ā Ā 

Ā 

The problem comes in if a branch with the old name is created.Ā  The forwarding no longer happens.Ā  This is understandable and in some scenarios might even be desirable.Ā  But it is again a potential pitfall when working in a large community.Ā  If we are able to block the creation of certain branches, this would not pose a significant problem.

Ā 

Ā 

Response: Suggested creating a new master branch with no shared history and a single README file. This broke auto-forwarding of links to master to the new main branch. They will consider our proposal. No indication of timing.


Use CircleCI to prevent creation of master branch

Ā 

https://github.com/rotated8/branch-tests/blob/main/.circleci/config.yml#L15

Ā 

Ā 

Ā 

Ā