jesseduffield/lazygit · info
You have no tracked/staged files to stash
Error message
You have no tracked/staged files to stash
What it means
Thrown from the stash menu's 'stash staged changes' item when AnyStagedFilesExceptSubmodules() is false. This option maps to 'git stash --staged' (SaveStagedChanges); the source comment notes that without something in the index the current implementation 'mucks the stash up', so lazygit requires at least one staged file before allowing it.
Solutions
- Stage at least one file first ('space' in the files panel), then choose stash staged changes
- If you meant to stash everything, use 'stash all changes' instead
Example fix
# before: nothing staged, stash-staged errors # after git add path/to/file # then select 'stash staged changes' (git stash --staged)
Defensive patterns
Strategy: validation
Validate before calling
// Require staged files for the --staged variant:
if !workingTree.AnyStagedFilesExceptSubmodules() {
return errors.New("stage at least one file before stashing staged changes")
} Prevention
- Check the index is non-empty before 'git stash --staged'
- Offer to fall back to 'stash all changes' when nothing is staged
- Show staged-count in the stash menu so the precondition is visible
When it happens
Trigger: Selecting 'stash staged changes' (menu key 's') when nothing is staged — all changes are unstaged or the tree is clean.
Common situations: Users who stage nothing but expect the option to stash their unstaged work, or who press it right after stashing once so the index is empty.
Related errors
- You have no files to stash
- You have no tracked/staged files to stash
- A remote named ' ' does not exist
- Base commit is not in current view
- Branch } is checked out by worktree }
AI-assisted analysis of jesseduffield/lazygit@c477a2959b (2026-08-15).
Data as JSON: /api/errors/f98136818aeb6687.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/gui/controllers/files_controller.go:1307
}
// if there are no staged files it behaves the same as Stash.Save
return self.handleStashSave(self.c.Git().Stash.StashAndKeepIndex, self.c.Tr.Actions.StashAllChangesKeepIndex)
},
Keys: menuKey('i'),
},
{
Label: self.c.Tr.StashIncludeUntrackedChanges,
OnPress: func() error {
return self.handleStashSave(self.c.Git().Stash.StashIncludeUntrackedChanges, self.c.Tr.Actions.StashIncludeUntrackedChanges)
},
Keys: menuKey('U'),
},
{
Label: self.c.Tr.StashStagedChanges,
OnPress: func() error {
// there must be something in staging otherwise the current implementation mucks the stash up
if !self.c.Helpers().WorkingTree.AnyStagedFilesExceptSubmodules() {
return errors.New(self.c.Tr.NoTrackedStagedFilesStash)
}
return self.handleStashSave(self.c.Git().Stash.SaveStagedChanges, self.c.Tr.Actions.StashStagedChanges)
},
Keys: menuKey('s'),
},
{
Label: self.c.Tr.StashUnstagedChanges,
OnPress: func() error {
if !self.c.Helpers().WorkingTree.IsWorkingTreeDirtyExceptSubmodules() {
return errors.New(self.c.Tr.NoFilesToStash)
}
if self.c.Helpers().WorkingTree.AnyStagedFilesExceptSubmodules() {
return self.handleStashSave(self.c.Git().Stash.StashUnstagedChanges, self.c.Tr.Actions.StashUnstagedChanges)
}
// ordinary stash
return self.handleStashSave(self.c.Git().Stash.Push, self.c.Tr.Actions.StashUnstagedChanges)
},
Keys: menuKey('u'),View on GitHub (pinned to c477a2959b)