C-us on an untracked file invokes the --intent-to-add
behaviour. You can then stage parts of the file as usual.
(Note though that you cannot unstage parts of the file as usual; so be careful of what you're staging.)
Edit: I've just noticed that Magit's ediff1 integration provides a great workaround for the inability to unstage selected parts in this scenario.
- Type e on the staged file
- Move to the
.~index~
window, which contains the staged changes
- Edit the content directly (but don't try to save the buffer)
- Exit ediff with q from the control buffer
- Confirm to Magit that you wish to update the index
- Profit!
1 I'll assume that you already know how to drive ediff. If not, then (a) I highly recommend taking some time to get familiar with it, because it's great; (b) ediff-window-setup-function
is the variable to customize to prevent it opening a separate frame for the control buffer; (c) It has its own manual at C-h i g (ediff)