29

If you create a new directory, its files won't show up with magit-status, only the new directory is in the list of Untracked items.

Currently I have to magit-stage-item the new directory and then remove unwanted files from the stage area.

Is there any way to choose which files to stage from a new directory?

1 Answer 1

40

Run:

git config status.showUntrackedFiles all

or if you want to enable this in all repositories:

git config --global status.showUntrackedFiles all

and refresh the status buffer. Initially you will still only see directories which contain untracked files, not the files themselves. But these directory sections can now be expanded using TAB.

One possible disadvantage of using status.showUntrackedFiles all is a chance of slow performance, when using Git directly - Magit actually counteracts that.

6
  • Is there a way to apply this setting globally? How can I add it to my ~/.gitconfig file? Commented Jul 16, 2016 at 0:12
  • @krystalcode: Try git config --global to modify global settings.
    – Toxaris
    Commented Sep 21, 2016 at 8:51
  • is it possible to limit how many files are shown per each directory? If I am selectivelly staging and ignoring fles from a directory, this could allow staging large directories a few files at a time without slowing down rendering too much
    – untore
    Commented Mar 9, 2021 at 8:32
  • No there is no support for that. In this special case you probably have to resort to doing some of the work outside of Magit.
    – tarsius
    Commented Mar 9, 2021 at 9:55
  • Is there some way to get magit to run git status --untracked-files (or other functional equivalent) to get this setting, so that I don't have to set it on my repository (or globally) in a way that effects command-line usage? I like the default behavior in the command-line, because I can then just run ls on the relevant directories if/when I want to, instead of getting lots of noisy output always... but in magit, I want a way of expanding things within that context. ?
    – lindes
    Commented Nov 17, 2023 at 14:58

Your Answer

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

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