{"record":{"id":"151a61a3281d1ff0","repo":"jesseduffield/lazygit","slug":"you-have-no-files-to-stash","errorCode":null,"errorMessage":"You have no files to stash","messagePattern":"You have no files to stash","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"pkg/gui/controllers/files_controller.go","lineNumber":1278,"sourceCode":"\nfunc (self *FilesController) switchToMerge() error {\n\tfile := self.getSelectedFile()\n\tif file == nil {\n\t\treturn nil\n\t}\n\n\treturn self.c.Helpers().MergeConflicts.SwitchToMerge(file)\n}\n\nfunc (self *FilesController) createStashMenu() error {\n\treturn self.c.Menu(types.CreateMenuOptions{\n\t\tTitle: self.c.Tr.StashOptions,\n\t\tItems: []*types.MenuItem{\n\t\t\t{\n\t\t\t\tLabel: self.c.Tr.StashAllChanges,\n\t\t\t\tOnPress: func() error {\n\t\t\t\t\tif !self.c.Helpers().WorkingTree.IsWorkingTreeDirtyExceptSubmodules() {\n\t\t\t\t\t\treturn errors.New(self.c.Tr.NoFilesToStash)\n\t\t\t\t\t}\n\t\t\t\t\treturn self.handleStashSave(self.c.Git().Stash.Push, self.c.Tr.Actions.StashAllChanges)\n\t\t\t\t},\n\t\t\t\tKeys: menuKey('a'),\n\t\t\t},\n\t\t\t{\n\t\t\t\tLabel: self.c.Tr.StashAllChangesKeepIndex,\n\t\t\t\tOnPress: func() error {\n\t\t\t\t\tif !self.c.Helpers().WorkingTree.IsWorkingTreeDirtyExceptSubmodules() {\n\t\t\t\t\t\treturn errors.New(self.c.Tr.NoFilesToStash)\n\t\t\t\t\t}\n\t\t\t\t\t// if there are no staged files it behaves the same as Stash.Save\n\t\t\t\t\treturn self.handleStashSave(self.c.Git().Stash.StashAndKeepIndex, self.c.Tr.Actions.StashAllChangesKeepIndex)\n\t\t\t\t},\n\t\t\t\tKeys: menuKey('i'),\n\t\t\t},\n\t\t\t{\n\t\t\t\tLabel: self.c.Tr.StashIncludeUntrackedChanges,","sourceCodeStart":1260,"sourceCodeEnd":1296,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/controllers/files_controller.go#L1260-L1296","documentation":"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.","triggerScenarios":"Opening the stash menu ('s' in the files panel, or the stash keybinding) and selecting 'stash all changes' with a clean working tree.","commonSituations":"Pressing stash right after committing everything, or in a freshly cloned repo; also when the only 'dirt' is inside submodules, which does not count.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check dirtiness (excluding submodules) before stashing:\nif !workingTree.IsWorkingTreeDirtyExceptSubmodules() {\n    return errors.New(\"nothing to stash\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["git","stash","clean-tree","empty-state"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}