File contents in HEAD commit:
A
B
C
D
After I modify the file, the contents is:
A
A2
B
C
D
D2
If I would like to revert the change at line 2 (A2), how can I do this with magit? So the result would have the contents be:
A
B
C
D
D2
File contents in HEAD commit:
A
B
C
D
After I modify the file, the contents is:
A
A2
B
C
D
D2
If I would like to revert the change at line 2 (A2), how can I do this with magit? So the result would have the contents be:
A
B
C
D
D2
The term used by Magit is "discard". Like e.g. "stage" it is considered an "apply variant". k discards the "thing at point". If there is a region that begins inside a hunk and ends inside the same hunk, then it is a "hunk-internal region". If there is such a selection, then the various apply-variant commands operate on the region's content instead of the complete section.
This is documented in Staging and Unstaging and Applying. It is also covered in the Getting Started part of the manual. You might want to give the documentation a chance.
What you have to do, boils down to this: goto A2
, type C-SPC followed by k.