git 状态不显示新添加文件夹的内容
git status not showing contents of newly added folder
我刚刚在 /
创建了一个新的 git 存储库 我在文件夹 test_fold
中创建了一个新文件 test.txt
因此文件的路径是 test_fold\test.txt
。我然后运行git status
。这是输出,它找到了文件夹但没有找到文件。为什么不显示 test_fold
中有一个新文件?
$ git status
On branch master
Initial commit
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitignore
test_fold/
nothing added to commit but untracked files present (use "git add" to track)
.gitignore
文件是空白的。
如果文件夹尚未包含跟踪路径,Git 将忽略该文件夹的内容。通过 test_fold/
的存在,您知道那里有文件(Git 永远不会向您显示未跟踪的空目录)并且您知道这些文件未被跟踪。
否则,将文件夹解压缩到您的存储库中可能会从 git status
中引入大量输出。简单显示顶级未跟踪路径的默认行为使输出更加清晰。
如果你想Git显示文件夹的内容,使用
$ git status -uall
这将向您显示 test_fold/test.txt
(和任何其他文件),而不仅仅是 test_fold/
。
我刚刚在 /
创建了一个新的 git 存储库 我在文件夹 test_fold
中创建了一个新文件 test.txt
因此文件的路径是 test_fold\test.txt
。我然后运行git status
。这是输出,它找到了文件夹但没有找到文件。为什么不显示 test_fold
中有一个新文件?
$ git status
On branch master
Initial commit
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitignore
test_fold/
nothing added to commit but untracked files present (use "git add" to track)
.gitignore
文件是空白的。
Git 将忽略该文件夹的内容。通过 test_fold/
的存在,您知道那里有文件(Git 永远不会向您显示未跟踪的空目录)并且您知道这些文件未被跟踪。
否则,将文件夹解压缩到您的存储库中可能会从 git status
中引入大量输出。简单显示顶级未跟踪路径的默认行为使输出更加清晰。
如果你想Git显示文件夹的内容,使用
$ git status -uall
这将向您显示 test_fold/test.txt
(和任何其他文件),而不仅仅是 test_fold/
。