git status in my configuration is extremely slow at enumerating untracked files, for reasons not relevant here. I'd like to have Magit use the -uno argument in most cases, in order to avoid a long delay every time I refresh the buffer, but also have the option of doing a full status (including untracked files) at will.

I'm not seeing a way to make this happen without modifying or advising Magit's code and mode map; there doesn't seem either to be an "ignore untracked files" option, or an option to add arbitrary command arguments to the git status invocation. Have I missed something, or do I have some hacking to do?

  • We both should delete that parts that are misunderstandings and clarifications. It will then be easier to answer the actual question. – tarsius Sep 29 '16 at 18:22
  • @tarsius Agreed and done. – Aaron Miller Sep 29 '16 at 19:26

The default value of the Git variable status.showUntrackedFiles is normal. In that case both git status and magit-status only lists directories containing untracked files (and untracked files at the top-level).

If you set it to all, then git status lists all individual untracked files, but it appears as if magit-status isn't affected. However it is now possible to expand such a directory section. TAB on foo/ in

Untracked files (1)


Untracked files (1)

The (1) is a bit unfortunate.

If the value is all and until foo/ is expanded, Magit actually pretends the value is normal. I have updated the documentation accordingly.

The reason Magit does it this way, is that all can be very costly and we cannot assume that users realize that setting this variable also affects Magit.

  • according to the git status man page, -uno is short for --untracked-files=no – npostavs Sep 23 '16 at 0:55
  • Thank you very much for the pointer to the correct repository! That's what I get for trusting Google to do the right thing when I search for "magit changelog"... – Aaron Miller Sep 23 '16 at 14:24

You can also just go to the un-tracked files heading and press TAB. It will fold it like an orgmode buffer heading.

  • I guess he can only do that when the files have been enumerated, ie too late... unless magit can "remember" that for next time? – JeanPierre Sep 27 '16 at 13:35
  • It does remember after setting it the first time if you don't kill the process even after changes and running magit-status a second time. If you kill the buffer though you will have to do it again. Not perfect fix but definitely simple. – Aaron F Sep 27 '16 at 13:52
  • Not the solution I'm looking for, but it does address the question I actually asked in the title. I've updated that to better reflect my intent. Thanks for drawing attention to the mismatch! – Aaron Miller Sep 29 '16 at 13:37

customize the magit-section-initial-visibility-alist set key to untracked and value to hide

(setq magit-section-initial-visibility-alist (quote ((untracked . hide))))

or you can do this through the emacs customize interface.

this will make untracked file hidden initially.

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .