-
Sometimes I get myself into a situation where I've made a lot of local changes and need to sort them into separate commits, and I frequently can't make the diff context small enough so that I can stage just the parts I want. I don't really know what the feature would look like, but it would be awesome to have a workaround for these situations. Maybe a way to directly edit the notional copy-of-the-file-in-the-index? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Often it is possible to mark the part that you want to stage using the region before staging, but I assume you know that. In really hairy cases, I sometimes end up reverting some changes by manually editing the file (or using undo, if I get lucky), staging, and then undoing the edits/undos. |
Beta Was this translation helpful? Give feedback.
-
Oh, this is great to know about! No, I wasn't aware of it!
… On Jun 1, 2023, at 12:22 AM, Jonas Bernoulli ***@***.***> wrote:
I mean this (from https://magit.vc/manual/magit/Staging-and-Unstaging.html):
With Magit, on the other hand, one can un-/stage individual hunks by
just moving point into the respective section inside a diff displayed in
the status buffer or a separate diff buffer and typing ‘s’ or ‘u’. To
operate on just parts of a hunk, mark the changes that should be
un-/staged using the region and then press the same key that would be
used to un-/stage. To stage multiple files or hunks at once use a
region that starts inside the heading of such a section and ends inside
the heading of a sibling section of the same type.
Not that while you can stage multiple hunks at once, by marking a region that begins in the header of one hunk and ends in the hunk of another (of the same file), you cannot stage the second half of one hunk and the first half of the next hunk together. The region must begin and end in the same hunk in this case. Also note how the region is visualized differently depending on what kind of selection you make. If it looks like in any other place, then it is not a valid selection as far as these commands are concerned.
—
Reply to this email directly, view it on GitHub <#4952 (reply in thread)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAAKYIIZKSMAQ5EGU3EG4O3XJBUNVANCNFSM6AAAAAAYRH7FTI>.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
I mean this (from https://magit.vc/manual/magit/Staging-and-Unstaging.html):
Note that while you can stage multiple hunks at once, by marking a region that beg…