Skip to content

Reset File in Git Status Picker #3012

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

Open
kevintraver opened this issue Mar 24, 2024 · 2 comments · May be fixed by #3396
Open

Reset File in Git Status Picker #3012

kevintraver opened this issue Mar 24, 2024 · 2 comments · May be fixed by #3396
Labels
enhancement Enhancement to performance, inner workings or existent features

Comments

@kevintraver
Copy link
Contributor

Is there a way to reset the selected file while inside the git status picker?

I tried using this action:

map({ "i", "n" }, "r", actions.git_reset_hard)

But it returns the following error:

Git returned: 'fatal: Cannot do hard reset with paths.'
@kevintraver kevintraver added the enhancement Enhancement to performance, inner workings or existent features label Mar 24, 2024
@kevintraver
Copy link
Contributor Author

Looks like #1368 might be related.

@ZenithFlux
Copy link

@kevintraver This is because a hard reset cannot be performed on files. I guess what you are looking for is an action to perform git restore -s HEAD <file>. But I don't think there is an action defined for it yet in telescope.

What I want is a default keybind (e.g. <C-r>) in the git_status picker, which performs a file restore. I am thinking of implementing it myself, though I can't find time to do that right now.

@ZenithFlux ZenithFlux linked a pull request Jan 5, 2025 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to performance, inner workings or existent features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants