Skip to content

Cannot see branches or remotes when there is a branch with an empty name #5112

@Conduitry

Description

@Conduitry

Describe the bug

I'm still unclear on how exactly this happened, but I had a repo with a local branch whose name was an empty string. Lazygit was unable to see any of my local branches or remotes on this repo.

Of note, Lazygit is still able to see the commit history on the current branch, even if it doesn't display the list of branches.

To Reproduce

Steps to reproduce the behavior:

  1. Clone or init any repo.
  2. Manually edit .git/config to have a [branch ""] section indicating a branch with an empty name. You don't need to create anything in this section.
  3. Run Lazygit and inspect the local branches and remotes section.

Expected behavior

The empty branch name should either be ignored, or else there should be an error somewhere that .git/config is invalid.

Screenshots

Image

Version info:

commit=17d03ec8cb89d4c65fd129228164562a220abefb, build date=2025-12-06T13:01:50Z, build source=binaryRelease, version=0.57.0, os=linux, arch=amd64, git version=2.34.1
git version 2.34.1

Additional context

Add any other context about the problem here.

None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions