jesseduffield/lazygit · warning
You have no tracked/staged files to stash
Error message
You have no tracked/staged files to stash
What it means
Returned by the 'discard staged changes' menu item in WorkspaceResetController when IsWorkingTreeDirtyExceptSubmodules() is false. The action works by stashing staged changes and immediately dropping the stash, so it needs at least some tracked/staged dirt to operate on; nothing to stash means nothing to discard.
Source
Thrown at pkg/gui/controllers/workspace_reset_controller.go:104
}
self.c.Refresh(
types.RefreshOptions{Scope: []types.RefreshableView{types.FILES}},
)
return nil
},
Keys: menuKey('c'),
},
{
LabelColumns: []string{
self.c.Tr.DiscardStagedChanges,
red.Sprint("stash staged and drop stash"),
},
Tooltip: self.c.Tr.DiscardStagedChangesDescription,
OnPress: func() error {
self.c.LogAction(self.c.Tr.Actions.RemoveStagedFiles)
if !self.c.Helpers().WorkingTree.IsWorkingTreeDirtyExceptSubmodules() {
return errors.New(self.c.Tr.NoTrackedStagedFilesStash)
}
if err := self.c.Git().Stash.SaveStagedChanges("[lazygit] tmp stash"); err != nil {
return err
}
if err := self.c.Git().Stash.DropNewest(); err != nil {
return err
}
self.c.Refresh(
types.RefreshOptions{Scope: []types.RefreshableView{types.FILES}},
)
return nil
},
Keys: menuKey('S'),
},
{
LabelColumns: []string{
self.c.Tr.SoftReset,View on GitHub (pinned to c477a2959b)
Solutions
- Verify with 'git status' that staged/tracked changes actually exist before picking the option.
- For untracked files use the dedicated 'delete untracked files' reset option instead.
- If only submodules changed, reset inside the submodule instead of the parent worktree.
Example fix
# before $ git status # clean -> choose Discard staged changes -> error # after $ git add -u && git status # staged changes present # choose Discard staged changes
Defensive patterns
Strategy: validation
Validate before calling
if !self.c.Helpers().WorkingTree.IsWorkingTreeDirtyExceptSubmodules() {
// disable the 'discard staged changes' menu item
} Prevention
- Disable the discard-staged menu item when IsWorkingTreeDirtyExceptSubmodules() is false.
- Check 'git status --short' for staged (uppercase-status) entries before choosing the option.
- Remember untracked files and submodule pointer changes are not stashable here.
When it happens
Trigger: Choosing 'Discard staged changes' from the reset-working-tree menu when the working tree is clean apart from (or entirely including only) submodule changes.
Common situations: User already staged and discarded via another path; only untracked files exist (they are not stashable here); only submodule pointers changed.
Related errors
- Expected renamed file
- Could not find deleted file or new file for file rename
- You have no files to stash
- You have no tracked/staged files to stash
- Git version must be at least %s. Please upgrade your git ver
AI-assisted analysis of jesseduffield/lazygit@c477a2959b (2026-08-15).
Data as JSON: /api/errors/f4e7e94da6eed078.
Report an issue: GitHub.