1

I have an existing folder containing a hole hierarchy of subfolders, some of them containing files.

I cd into this folder, and then do git init ..

If I immediately do git status, only the direct entries in the directory appear, not their content:

bli@naples:/tmp$ mkdir repo
bli@naples:/tmp$ mkdir repo/subfolder1
bli@naples:/tmp$ mkdir repo/subfolder2
bli@naples:/tmp$ touch repo/file1
bli@naples:/tmp$ touch repo/subfolder1/file11
bli@naples:/tmp$ touch repo/subfolder2/file21
bli@naples:/tmp$ cd repo
bli@naples:/tmp/repo$ git status
fatal: Not a git repository (or any parent up to mount point /tmp)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
bli@naples:/tmp/repo$ git init .
Initialized empty Git repository in /tmp/repo/.git/
bli@naples:/tmp/repo$ git status
On branch master

Initial commit

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    file1
    subfolder1/
    subfolder2/

nothing added to commit but untracked files present (use "git add" to track)

I think I remember git status used to show subfolder contents. Did I dream that?

Mureinik
  • 297,002
  • 52
  • 306
  • 350
bli
  • 7,549
  • 7
  • 48
  • 94

1 Answers1

2

The subfolders currently aren't tracked by git, so git status won't show their content. Once you add the first file under the subfolder, you'll also see information about the untracked files in that subfolder.

Mureinik
  • 297,002
  • 52
  • 306
  • 350
  • 2
    You can use `--untracked-files=all` option (or set `status.showUntrackedFiles` config to `all` for permanent behavior) to force git to show files in untracked directories (https://git-scm.com/docs/git-status#git-status---untracked-filesltmodegt) – zigarn Dec 02 '17 at 06:55