In git, if I have a couple of hunks from the same file staged in my index, how can I interactively unstage one of them?
Is there any alternative to unstaging the entire file, and then re-staging the hunks I want to keep, or manually undoing the changes to the working copy, and then interactively adding those undone changes?
Try git reset --patch filename
; this should do the opposite of git add --patch
, according to the documentation. The short form -p
also works for both commands.