Wondering if it's possible to indicate intent to add a file via magit.

The intention would be to stage parts of an untracked file for a commit but leave the rest, rather than the default git add behaviour of adding the entire file (which might have various wip bits).

1 Answer 1


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)

  • Just dipping my toes into the water with ediff, will definitely be digging into it more. Thanks for the tips. Dec 6, 2017 at 23:52

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.