Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: discard changes from selected files only #3620

Open
insane-dreamer opened this issue May 31, 2024 · 6 comments
Open

Feature request: discard changes from selected files only #3620

insane-dreamer opened this issue May 31, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@insane-dreamer
Copy link

It would be nice to be able to discard changes from certain files only (the currently selected file(s) in the Commit panel, which are also displayed in the "Unstaged changes" panel)

when pressing d (discard), there could be an additional option to Discard changes from selected files

@insane-dreamer insane-dreamer added the enhancement New feature or request label May 31, 2024
@insane-dreamer insane-dreamer changed the title Feature request: discard single file Feature request: discard changes from selected files only May 31, 2024
@mark2185
Copy link
Collaborator

mark2185 commented May 31, 2024

If I understood you correctly, resetting just the currently selected file in the commits view to HEAD?

@insane-dreamer
Copy link
Author

insane-dreamer commented May 31, 2024

Yes, that's correct (one or more files if multiple files are selected)

@insane-dreamer
Copy link
Author

insane-dreamer commented Jun 21, 2024

Actually, it turns out that this feature already exists. Select multiple files, press d and then select Discard all changes. I just didn't notice it because the wording sounds like it will discard all staged/unstaged changes, not just from the selected files. So maybe the only requested change would be to change the wording to Discard all changes from selected files (when one or more files are selected).

@stefanhaller
Copy link
Collaborator

We already have a pretty prominent tooltip telling you this, isn't that enough? Of course it's also easy to change the wording of the command like you suggest, I was just wondering.

@insane-dreamer
Copy link
Author

Yeah, the tooltip is probably sufficient -- it does list the affected files. The rewording could be useful, but certainly not essential.

@stefanhaller
Copy link
Collaborator

I just realized that the real issue is probably that we only show the "Discard unstaged changes" item when a file with both unstaged and staged changes is selected; otherwise we only show the "Discard all changes" entry, and in that case it's not clear that "all" is meant in contrast to "unstaged", and not "all files in the working copy". I opened #3683 to improve that, if you want to have a look at that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants