Support renaming the `master` branch without disruption
<!-- The first four sections: "Problem to solve", "Intended users", "User experience goal", and "Proposal", are strongly recommended, while the rest of the sections can be filled out during the problem validation or breakdown phase. However, keep in mind that providing complete and relevant information early helps our product team validate the problem and start working on a solution. -->
### Problem to solve
<!-- What problem do we solve? Try to define the who/what/why of the opportunity as a user story. For example, "As a (who), I want (what), so I can (why/value)." -->
Provide an easy way for a maintainer of an existing repository who wants to move away from the `master` name for the default branch (for the same reasons a user would [choose a different default branch name for a new repository](https://gitlab.com/gitlab-org/gitlab/-/issues/220906)) to rename the branch without causing massive disruption.
### Intended users
Presumably the same as [the feature for choosing the initial branch name](https://gitlab.com/gitlab-org/gitlab/-/issues/220906).
### User experience goal
A repository maintainer can rename the `master` branch via UI or some other straightforward documented method.
### Proposal
Currently, if I manually create a branch with the desired new name, I can set it as the default branch, but AIUI that only affects newly created merge requests and maybe a few other things. We probably want to introduce a separate mechanism for a branch rename.
Things the new feature would need to do:
- Existing local clones that reference the old branch name should still be able to fetch it and (if possible) push to it, possibly with a warning to the user. There's an [ongoing discussion](https://lore.kernel.org/git/20200803194006.GA2715275@coredump.intra.peff.net/) of features that might be added to the standard git client and server to facilitate branch renames. GitLab may be able to use some of those or may need its own implementation depending on technical constraints (I haven't researched how GitLab is currently implemented).
- Existing merge requests targeting the old branch name should be updated to target the new branch name: should be straightforward.
- Forks of the repository hosted on GitLab: I'm not familiar with what might need to be done.
- Probably more. Every GitLab feature may need to be reviewed.
### Further details
<!-- Include use cases, benefits, goals, or any other details that will help us understand the problem better. -->
Nothing to say here yet
### Permissions and Security
It looks to me that project maintainer would be the most appropriate permission to require for this action.
### Documentation
<!-- See the Feature Change Documentation Workflow https://docs.gitlab.com/ee/development/documentation/workflow.html#for-a-product-change
* Add all known Documentation Requirements in this section. See https://docs.gitlab.com/ee/development/documentation/feature-change-workflow.html#documentation-requirements
* If this feature requires changing permissions, update the permissions document. See https://docs.gitlab.com/ee/user/permissions.html -->
TBD
### Availability & Testing
<!-- This section needs to be retained and filled in during the workflow planning breakdown phase of this feature proposal, if not earlier.
What risks does this change pose to our availability? How might it affect the quality of the product? What additional test coverage or changes to tests will be needed? Will it require cross-browser testing?
Please list the test areas (unit, integration and end-to-end) that needs to be added or updated to ensure that this feature will work as intended. Please use the list below as guidance.
* Unit test changes
* Integration test changes
* End-to-end test change
See the test engineering planning process and reach out to your counterpart Software Engineer in Test for assistance: https://about.gitlab.com/handbook/engineering/quality/test-engineering/#test-planning -->
TBD
### What does success look like, and how can we measure that?
<!-- Define both the success metrics and acceptance criteria. Note that success metrics indicate the desired business outcomes, while acceptance criteria indicate when the solution is working correctly. If there is no way to measure success, link to an issue that will implement a way to measure this. -->
TBD
### What is the type of buyer?
<!-- What is the buyer persona for this feature? See https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/buyer-persona/
In which enterprise tier should this feature go? See https://about.gitlab.com/handbook/product/pricing/#four-tiers -->
Presumably the same as [the feature for choosing the initial branch name](https://gitlab.com/gitlab-org/gitlab/-/issues/220906).
### Is this a cross-stage feature?
<!-- Communicate if this change will affect multiple Stage Groups or product areas. We recommend always start with the assumption that a feature request will have an impact into another Group. Loop in the most relevant PM and Product Designer from that Group to provide strategic support to help align the Group's broader plan and vision, as well as to avoid UX and technical debt. https://about.gitlab.com/handbook/product/#cross-stage-features -->
TBD
### Links / references
- [git initial announcement of the move away from `master`](https://lore.kernel.org/git/pull.656.v4.git.1593009996.gitgitgadget@gmail.com/)
- [GitHub's brief plan for a "seamless move for existing repositories"](https://github.com/github/renaming#later-this-year-seamless-move-for-existing-repositories-)
- [Analogous feature request for BitBucket](https://jira.atlassian.com/browse/BCLOUD-20349)
<!-- Label reminders - you should have one of each of the following labels if you can find the correct ones!
Type - for example ~feature ~bug ~documentation ~meta /label ~"feature::addition" ~"feature::maintenance" ~tooling ~"tooling::pipelines" ~"tooling::workflow" per https://docs.gitlab.com/ee/development/contributing/issue_workflow.html#type-labels
DevOps stage - for example ~"devops::secure"
Group - for example ~"group::composition analysis"
Category - for example ~"Category:Dependency Scanning"
<!-- Label reminders - you should have one of each of the following labels if you can figure out the correct ones! -->
<!-- TBD:
-->
issue