{"record":{"id":"f4e7e94da6eed078","repo":"jesseduffield/lazygit","slug":"you-have-no-tracked-staged-files-to-stash-f4e7e9","errorCode":null,"errorMessage":"You have no tracked/staged files to stash","messagePattern":"You have no tracked/staged files to stash","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/gui/controllers/workspace_reset_controller.go","lineNumber":104,"sourceCode":"\t\t\t\t}\n\n\t\t\t\tself.c.Refresh(\n\t\t\t\t\ttypes.RefreshOptions{Scope: []types.RefreshableView{types.FILES}},\n\t\t\t\t)\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tKeys: menuKey('c'),\n\t\t},\n\t\t{\n\t\t\tLabelColumns: []string{\n\t\t\t\tself.c.Tr.DiscardStagedChanges,\n\t\t\t\tred.Sprint(\"stash staged and drop stash\"),\n\t\t\t},\n\t\t\tTooltip: self.c.Tr.DiscardStagedChangesDescription,\n\t\t\tOnPress: func() error {\n\t\t\t\tself.c.LogAction(self.c.Tr.Actions.RemoveStagedFiles)\n\t\t\t\tif !self.c.Helpers().WorkingTree.IsWorkingTreeDirtyExceptSubmodules() {\n\t\t\t\t\treturn errors.New(self.c.Tr.NoTrackedStagedFilesStash)\n\t\t\t\t}\n\t\t\t\tif err := self.c.Git().Stash.SaveStagedChanges(\"[lazygit] tmp stash\"); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif err := self.c.Git().Stash.DropNewest(); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tself.c.Refresh(\n\t\t\t\t\ttypes.RefreshOptions{Scope: []types.RefreshableView{types.FILES}},\n\t\t\t\t)\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tKeys: menuKey('S'),\n\t\t},\n\t\t{\n\t\t\tLabelColumns: []string{\n\t\t\t\tself.c.Tr.SoftReset,","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/controllers/workspace_reset_controller.go#L86-L122","documentation":"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.","triggerScenarios":"Choosing 'Discard staged changes' from the reset-working-tree menu when the working tree is clean apart from (or entirely including only) submodule changes.","commonSituations":"User already staged and discarded via another path; only untracked files exist (they are not stashable here); only submodule pointers changed.","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."],"exampleFix":"# before\n$ git status   # clean -> choose Discard staged changes -> error\n\n# after\n$ git add -u && git status   # staged changes present\n# choose Discard staged changes","handlingStrategy":"validation","validationCode":"if !self.c.Helpers().WorkingTree.IsWorkingTreeDirtyExceptSubmodules() {\n    // disable the 'discard staged changes' menu item\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["git","stash","discard","working-tree"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}