Skip to content

[Improvement] Add "main" to master branch regex #2366

@thetimbecker

Description

@thetimbecker

As many more organizations (including GitHub) and repositories are moving towards naming their default branch main instead of master, it would be useful to include this naming in the default configuration.

Detailed Description

This can easily be implemented in a completely backwards compatible way; repositories that use master will still recognize that as the master branch. The develop branch regex already has alternate naming conventions (^dev(elop)?(ment)?$), so there is precedence within GitVersion for this.

Side note: that regex qualifies devment as a valid develop branch name 😁

Context

Our organization is making this change and many of our repos use GitVersion. We could make custom configurations for all these repositories, but that is yet another configuration file to maintain and distribute. As this is a movement that is gaining popularity across the board, it would be useful to have this baked into GitVersion and not require a custom configuration.

main seems to be the general consensus from the community as the preferred alternative to master. It also seems to be the preferred name of the developer who chose the original names.

Possible Implementation

thetimbecker@05377a4

Change the default regex for master branches from ^master$ to ^master|main$. This would be done by updating MasterBranchRegex in src/GitVersionCore/Model/Configuration/Config.cs, as well as updating the documentation and tests.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions