-
-
Notifications
You must be signed in to change notification settings - Fork 236
Description
Is your feature request related to a problem? Please describe.
I regularly use git reset --patch
as the inverse of git add --patch
and need to do this manually right now.
Describe the solution you'd like
It would be great if I could map <leader>hu
to an unstage_hunk
function instead of undo_stage_hunk
which is limited to the last hunk that was staged.
Describe alternatives you've considered
- At first I expected that
undo_stage_hunk
to matchgit reset --patch
, but of course this is not the case. - I believe
reset_hunk
is effectively a--hard
git reset, orgit checkout --patch
. reset_buffer_index
unstages everything in the buffer which is usually not what I want
So I normally use :!git reset -p %
which is more time consuming.
Additional context
-
It's easy for me to understand the behavior of an
unstage_hunk
function because I frequently usegit reset -p
. However I expect it would be more clear to others if secondary signs as described in Sec #303 and Add signs for staged hunks #440. I expect thatunstage_hunk
would effectively operate on hunks indicated by secondary signs. -
Adding an optional
range
argument, similar to the range argument instage_hunk(range)
would also be handy. I've often found it difficult to edit patches withgit reset --patch
, so I'm not sure if this would be tricky to implement in practice.