jesseduffield/lazygit · info
Nothing to stage: the parent repo can only stage a new submo
Error message
Nothing to stage: the parent repo can only stage a new submodule commit, not the uncommitted changes inside a submodule. Commit inside the submodule first.
What it means
Thrown by FilesController.toggleStaged as a terminal fallback: the selection contained only a submodule whose dirtiness is uncommitted content inside the submodule (no new submodule commit), there was nothing unstaged to stage, and nothing staged to unstage. The parent repo can only stage a new submodule pointer commit, so the toggle would be a silent no-op and lazygit explains why instead.
Source
Thrown at pkg/gui/controllers/files_controller.go:555
return err
}
shouldStage = !noOp
}
if shouldStage {
self.c.LogAction(stageAction)
if err := self.optimisticChange(unstagedNodes, self.optimisticStage); err != nil {
return err
}
return stage(unstagedNodes)
}
// If there's nothing staged to unstage either, then the only thing we acted
// on was an unstageable submodule and nothing happened, so say why.
if !someNodesHaveStagedChanges(nodes) {
return errors.New(self.c.Tr.NothingToStageForSubmodule)
}
self.c.LogAction(unstageAction)
if err := self.optimisticChange(nodes, self.optimisticUnstage); err != nil {
return err
}
return unstage(nodes)
}
func (self *FilesController) pressWithLock(selectedNodes []*filetree.FileNode) error {
// When filtering, expand directory nodes to individual visible file paths
// so that only filtered files are staged/unstaged.
toPaths := func(nodes []*filetree.FileNode) []string {
if self.context().IsFiltering() {
var paths []string
for _, node := range nodes {View on GitHub (pinned to c477a2959b)
Solutions
- Enter the submodule (lazygit supports nested repos) and commit inside it first
- Then return to the parent repo and stage the updated submodule pointer
Example fix
# before: dirty submodule, space in parent errors # after cd path/to/submodule && git add -A && git commit -m 'work' cd .. && git add path/to/submodule # stage new pointer
Defensive patterns
Strategy: validation
Validate before calling
// Before toggling stage on a selection, detect unstageable submodule-only content:
if len(unstagedNodes) == 0 && !someNodesHaveStagedChanges(nodes) {
return errors.New("commit inside the submodule first; the parent repo stages only the new pointer")
} Prevention
- Commit inside submodules before staging them in the parent repo
- Treat dirty submodules as pointers: only new submodule commits are parent-stageable
- Provide a 'enter submodule' shortcut in the error path so users can act on it
When it happens
Trigger: Pressing 'space' on a file node that is a dirty/untracked-content submodule — the parent repo sees no stageable change for it and nothing else in the selection is stageable.
Common situations: Users treating a submodule like a normal directory and pressing space expecting its inner modifications to be staged from the parent repo.
Related errors
- Cannot stage/unstage directory containing files with inline
- Multiple base commits found. (Try staging fewer changes at o
- Git version must be at least %s. Please upgrade your git ver
- Lazygit does not support bare repos.
- unexpected git output
AI-assisted analysis of jesseduffield/lazygit@c477a2959b (2026-08-15).
Data as JSON: /api/errors/3c6827a14e8ef649.
Report an issue: GitHub.