Commits panel: checkout fails for a branch in another worktree
Author: seflueCreated Sep 25, 2026Updated Sep 25, 2026
Since #4117, pressing space on a commit offers to check out a branch that points at it. If another worktree has that branch checked out, the checkout fails with git's error. The Branches panel asks to switch to that worktree instead.
I have a fix with an integration test on my fork: https://github.com/seflue/lazygit/tree/worktree-aware-checkout-from-commits. It reuses the Branches panel's prompt and stays in the Commits panel after the switch.
Relates to #4115.
Source: jesseduffield/lazygit