How do you stage a hunk into git from ediff?
I'd like to be able to view a side-by-side diff and stage hunks into the "HEAD" side of the diff, but that buffer (i.e., spacemacs.~master~
) is read-only. Ideally, I could also edit that staged file (to achieve the precision I'd get from editing a hunk from git command-line).
It looks like I can invoke magit status (M-x magit-status
), expand a diff (TAB
), and use s
to stage a diff hunk, but I'd like to do this on a file-by-file basis and from a side-by-side diff.
I'm hoping to replicate the behavior of vim-fugitive.
magit-status
, select the relevant part you want to split and presss
.magit
then only stages the selected region and leaving the rest out. You can create a commit out of it then repeat for the remaining part. – Tu Do May 13 '15 at 13:09TAB
to expand a diff,V
to select a line in the hunk, ands
to stage, I getevil-change: Buffer is read-only: #<buffer *magit: emacs.d*>
. If I comment out my visual modes
binding and try again, then emacs is waiting for another key (I sees-
at the bottom). PressingS
gives me the same read-only error. – idbrii May 13 '15 at 13:22develop
branch. See this issue. – Tu Do May 13 '15 at 13:30next
branch. The index buffer is now always writable when using ediff. It sounds like you already figured out how to use ediff for staging in it was only this bug that kept you from doing it. In case that is not so and for the benefit of others who don't know how to do it, I'll provide an answer. – tarsius May 13 '15 at 14:23