Fix discard unstaged changes incorrectly requiring staged changes#5406
Open
dhanush0x96c wants to merge 1 commit intojesseduffield:masterfrom
Open
Fix discard unstaged changes incorrectly requiring staged changes#5406dhanush0x96c wants to merge 1 commit intojesseduffield:masterfrom
dhanush0x96c wants to merge 1 commit intojesseduffield:masterfrom
Conversation
The "Discard unstaged changes" menu item was incorrectly disabled when no staged changes were present, even if unstaged changes existed. This change ensures it is only disabled when there are no unstaged changes.
Author
|
Note: updated the English translation only; other languages are handled via Crowdin. |
themavik
reviewed
Mar 23, 2026
themavik
left a comment
There was a problem hiding this comment.
Disabled state now matches the action: unstaged discard only needs unstaged worktree deltas, not staged ones. Tooltip string lines up with the new check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #5388
This PR fixes the logic controlling when the "Discard unstaged changes" menu option is disabled in the files panel.
Previously, the option could be incorrectly disabled even when there were unstaged changes available to discard. This change ensures the option is only disabled when there are no unstaged changes.
Problem
The previous condition disabled the menu item when either:
This was overly restrictive. The availability of the action should depend solely on whether there are unstaged changes. As a result, users were prevented from discarding unstaged changes simply because no staged changes were present.
Solution
The condition has been simplified:
This aligns the UI behavior with user expectations and the intent of the action.
Visual Changes
Before
After
Testing
Checklist
go generate ./...)