jesseduffield/lazygit · info
You have no files to stash
Error message
You have no files to stash
What it means
Thrown from the stash menu's 'stash all changes' item when IsWorkingTreeDirtyExceptSubmodules() is false — the working tree has no modifications (ignoring submodule dirt, which the parent repo cannot stash anyway). 'git stash' with nothing to stash fails or is a no-op, so lazygit pre-checks and reports it in friendlier terms.
Source
Thrown at pkg/gui/controllers/files_controller.go:1278
func (self *FilesController) switchToMerge() error {
file := self.getSelectedFile()
if file == nil {
return nil
}
return self.c.Helpers().MergeConflicts.SwitchToMerge(file)
}
func (self *FilesController) createStashMenu() error {
return self.c.Menu(types.CreateMenuOptions{
Title: self.c.Tr.StashOptions,
Items: []*types.MenuItem{
{
Label: self.c.Tr.StashAllChanges,
OnPress: func() error {
if !self.c.Helpers().WorkingTree.IsWorkingTreeDirtyExceptSubmodules() {
return errors.New(self.c.Tr.NoFilesToStash)
}
return self.handleStashSave(self.c.Git().Stash.Push, self.c.Tr.Actions.StashAllChanges)
},
Keys: menuKey('a'),
},
{
Label: self.c.Tr.StashAllChangesKeepIndex,
OnPress: func() error {
if !self.c.Helpers().WorkingTree.IsWorkingTreeDirtyExceptSubmodules() {
return errors.New(self.c.Tr.NoFilesToStash)
}
// 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,View on GitHub (pinned to c477a2959b)
Solutions
- Nothing to do — the tree is clean; dismiss the message
- If you expected changes, refresh the files panel ('r') in case the model is stale
- If the changes are only inside a submodule, enter the submodule and stash there
Defensive patterns
Strategy: validation
Validate before calling
// Check dirtiness (excluding submodules) before stashing:
if !workingTree.IsWorkingTreeDirtyExceptSubmodules() {
return errors.New("nothing to stash")
} Prevention
- Disable stash menu items when the tree is clean
- Remember submodule-internal dirt never counts for parent-repo stash
- In scripts, gate 'git stash' on 'git status --porcelain' being non-empty
When it happens
Trigger: Opening the stash menu ('s' in the files panel, or the stash keybinding) and selecting 'stash all changes' with a clean working tree.
Common situations: Pressing stash right after committing everything, or in a freshly cloned repo; also when the only 'dirt' is inside submodules, which does not count.
Related errors
- You have no tracked/staged files to stash
- No files staged
- You have no tracked/staged files to stash
- Git version must be at least %s. Please upgrade your git ver
- Lazygit does not support bare repos.
AI-assisted analysis of jesseduffield/lazygit@c477a2959b (2026-08-15).
Data as JSON: /api/errors/151a61a3281d1ff0.
Report an issue: GitHub.