Skip to content

Feat: add support for multiple-repositories, show a repos list when lazygit starts in a directory of repos - #6097

Open
janosmiko wants to merge 1 commit into
jesseduffield:masterfrom
janosmiko:multi-repo
Open

janosmiko wants to merge 1 commit into
jesseduffield:masterfrom
janosmiko:multi-repo

Conversation

@janosmiko

@janosmiko janosmiko commented Oct 7, 2026 •

Copy link
Copy Markdown

PR Description

When you start lazygit in a directory that is not a git repo but contains repos, lazygit now lists those repos in a new Repositories panel. Before this change, lazygit showed the "not a repository" prompt and it still shows if there's no repos in the subdirs.

  • Discovery walks down multiRepo.maxDepth levels (default 2). It stops at each repo, so it does not list nested repos or submodules. It skips hidden directories and symlinks.
  • Lazygit opens the first valid repo (sorted by path) and focuses the list. If a repo is broken, for example an empty .git or a stale worktree .git file, lazygit skips it.
  • The Repositories panel replaces the Status panel in window 1. repos is a new valid tab name for gui.sidePanels. If your config lists repos already, lazygit uses it as is.
  • Each row shows the path relative to the start directory, the branch, and * if the working tree has changes. The open repo has a marker, like the current worktree in the Worktrees panel.
  • space or enter switches to the selected repo. Focus stays on the list. The main view shows git status for the selected repo. e and u from the Status panel work here too, and ctrl+r still opens recent repos.
  • If lazygit finds no repos, the existing notARepository behavior runs. GIT_DIR and -p work as before.

Performance:

  • Lazygit reads branch names from HEAD files. Dirty checks run git status --porcelain in the background, 8 at a time, with GIT_OPTIONAL_LOCKS=0. So they never take index.lock in a repo that you work in, and they do not block a repo switch.
  • The full list reloads at startup, on a repo switch, and on R. Other refreshes update only the row of the open repo. The periodic files refresh does not touch the list.

Out of scope for this PR: ahead/behind counts, rebase/merge state per repo, and bulk fetch or pull across repos.

Known limitation: a repo switch clears the list filter. All other panels behave the same way on a repo switch.

Open question: I replaced the Status panel in this mode because Status shows only the current repo. If you prefer the list as a separate tab next to Status, I can change it, but I think this is a pretty great UX.

CleanShot 2026-10-07 at 12 29 46@2x

Please check if the PR fulfills these requirements

  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • Docs have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

I checked these facts against commit e9d5155:

  • go generate added the "Repositories" section to every docs-master/keybindings/*.md and the new key to Config.md.
  • The loader reads multiRepo.maxDepth from the config at each full reload, so a changed value takes effect on the next R.
  • The last checkbox is your own read-through, so I left it unchecked.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant