How do I show only untracked subdirectories that are git repos? Do I use git diff
, git status
, or git ls
? What options do I use?
The closest thing I could find is:
git diff --name-only --diff-filter=M
but that shows modified, not untracked. And it shows files.
I'm looking for something like:
$ git init .
Initialized empty Git repository in /tmp/my-dir
$ touch my-file
$ git add my-file
$ git commit -m 'init'
[master (root-commit) 3f18576] init
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 my-file
$ echo changed >> my-file
$ mkdir sub-repo
$ cd sub-repo
$ git init .
Initialized empty Git repository in /tmp/my-dir/sub-repo/.git/
$ touch my-file-sub-repo
$ cd ..
$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: my-file
Untracked files:
(use "git add <file>..." to include in what will be committed)
sub-repo/
$ git # diff? What options?
my-dir
(Related: I don't know how git is treating these "sub-repos" but would like to understand. Maybe git is considering them as git submodules, even though I never explicitly ran any git submodule commands?)