Provide choice of initial branch name when GitLab creates a repository for a user
Problem to solve
The default initial branch name when using git is master
. This has raised eyebrows among some.
Git itself does have support for changing the default name of the initial branch to be something else, and there isn't consensus on the "best" default name anyway. We have tended to use master
for our own projects, but I'm accustomed to seeing Git projects where the default branch is called develop
, which makes a lot of sense when (as in Git Flow or GitLab Flow), release branches are made off it.
The tweet mentions the name release
as a potential option. It's not something I've seen before, but is a reasonable name for a rolling-release project.
Mercurial calls the default initial branch... well, default
.
GitLab is currently fairly opinionated about the default initial branch name, despite this diversity of preferences - in most situations, it will create a new project with a master
branch, or configured for the first new branch to be master
, without any user input, and without providing any choice to the user.
Intended users
User experience goal
Freedom of choice for new projects
Proposal
When using any of these project creation options:
If the initial branch name to be used isn't clear from the context, then we should prompt the user to choose from a list of standard options, also permitting free-form entry.
The default could continue to be master
, since that has most interoperability at the moment, or we could consider making it group-level configurable, which would be handy for organisations to express a particular standard (say, they have decided to call the default initial branch develop
across their organisation).
The default branch to use is clear from context when importing an already-existing repository, whether from a GitLab export or third-party repo, since that specifies the default branch to use.
Creating a new empty repository, one with a README, or creating a new repository from a template, all leave the question open.
Further details
Naming is hard
This issue is triggered from BLM, but default
, develop
, etc, do predate that.
Whether master
is an appropriate term in this context or not is probably best taken up at the git-project-level, but even if git decided to change their default to default
, to match mercurial, as a consequence, people would still want to call their default branch develop
in some cases.
Is this a cross-stage feature?
To an extent, this is groupsource code , but devopsmanage are responsible for project templates, I believe. It doesn't require any change to project templates themselves; they will all have the master
branch in their bundles, but we can change it in a post-export step. We could go through and rename the default in all of them to default
, if we felt like it.