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

  1. Nothing to do — the tree is clean; dismiss the message
  2. If you expected changes, refresh the files panel ('r') in case the model is stale
  3. 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

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


AI-assisted analysis of jesseduffield/lazygit@c477a2959b (2026-08-15). Data as JSON: /api/errors/151a61a3281d1ff0. Report an issue: GitHub.