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] Reversing Hunks #1461

Open
KodyVB opened this issue Aug 28, 2024 · 0 comments
Open

[Feature Request] Reversing Hunks #1461

KodyVB opened this issue Aug 28, 2024 · 0 comments

Comments

@KodyVB
Copy link

KodyVB commented Aug 28, 2024

Is your feature request related to a problem? Please describe.
If I'm looking through recent commits and find a hunk I want to reverse, I don't think there's currently a way to easily do so outside of taking note of the filename and line number and manually changing it.

Describe the solution you'd like
Like staging/unstaging sections by just hovering over the hunk and pressing s or u, it would be nice to be able to reverse a hunk to a previous commit's state by hovering over that hunk and pressing some key combination.

Describe alternatives you've considered
Manually changing the lines in question is what I usually wind up doing, but the following command does similar to what I was thinking:

git checkout -p [highlighted commit]^1 -- path/to/file

With the caveat that the above command will interactively walk through all of the hunks rather than being able to just select the one.

Additional context
I don't use emacs, so I couldn't confirm if this is exactly what I was thinking of, but it does seem like magit has this feature here.

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

No branches or pull requests

1 participant