11

How do git commit -p in magit?

Not have this section in man page

2 Answers 2

12

The status buffer will show the unstaged changes. Move point to the changes that you want to stage, and call magit-stage (s). If you want to stage a subset of changes within a single hunk, you can select the lines with the region before calling magit-stage.

See the "Staging and unstaging" section of the manual for more information.

1

If you want to stage lines of codes you can do magit-status, then on one file in the list of unstaged files d, then I select the lines you want to stage, then s.

7
  • 1
    d runs magit-diff-popup. Why are you suggesting that?
    – phils
    Mar 14, 2018 at 19:37
  • 1
    @phils Presumably, the idea is to press "d d" to get to a magit diff and then select and stage the desired change and stage those with "s". The answer could use a few more details though, IMO.
    – Qudit
    Mar 14, 2018 at 22:39
  • 1
    I expect you're right; but it's very odd (to my mind) to suggest firstly going to the status buffer and then opening a diff buffer, given that all the diffs are available directly within the status buffer. I can't imagine many people would do it that way.
    – phils
    Mar 14, 2018 at 23:05
  • 1
    @leontalbot you can see all the unstaged changes and use C-SPC selection from the status buffer too. Why do you want to go to the diff buffer?
    – npostavs
    Mar 15, 2018 at 12:29
  • 1
    Yes -- in exactly the same way. Expand the file, select a region, and type s to stage the region.
    – phils
    Mar 15, 2018 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.