Skip to content

Handle repos that use 'main' as the main branch #1062

@PGScully

Description

@PGScully

Is your feature request related to a problem? Please describe.

GitHub and git are now using 'main' instead of 'master' for the default branch name. lazygit only considers 'master', and colors 'main' as a branch instead of the default branch.

Describe the solution you'd like

git can now be configured to use any name as the default branch with the following config snippet:

[init]
        defaultBranch = main

lazygit should use the defaultBranch option for programatically determine the branch to color as master, and fall back to 'master' or 'main' if it's not present.

Describe alternatives you've considered

Additional context

https://github.com/github/renaming

git 2.28 introduced the defaultBranch config option: https://github.blog/2020-07-27-highlights-from-git-2-28/#introducing-init-defaultbranch

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions