git status 不显示新添加文件夹的内容
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28222633/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git status not showing contents of newly added folder
提问by Vader
I just created a new git repo at /
I created a new filetest.txt
in the folder test_fold
so that the path to the file is test_fold\test.txt
. I then run git status
. This is the output, it finds the folder but not the file. Why is not showing me that there is a new file in test_fold
?
我刚刚在/
文件test.txt
夹中创建了一个新文件时创建了一个新的 git repo,test_fold
以便该文件的路径为 .git 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)
The .gitignore
file is blank.
该.gitignore
文件是空白的。
回答by meagar
Git will ignore the context of a folder if the folder doesn't already contain tracked paths. You know by the presence of test_fold/
that there are files in there (Git will never show you an empty directory as being untracked) and you know that those files are not tracked.
如果文件夹尚未包含跟踪路径,Git 将忽略文件夹的上下文。您知道test_fold/
那里有文件(Git 永远不会向您显示未跟踪的空目录),并且您知道这些文件没有被跟踪。
Otherwise, unzipping a folder into your repository could potentially introduce huge amounts of output from git status
. The default behavior of simply showing the top-level untracked path makes for much saner output.
否则,将文件夹解压缩到您的存储库中可能会从git status
. 简单地显示顶级未跟踪路径的默认行为会产生更明智的输出。
If you want Git to show you the content of the folder, use
如果您希望 Git 向您显示文件夹的内容,请使用
$ git status -uall
This will show you test_fold/test.txt
(and any other files) instead of just test_fold/
.
这将显示您test_fold/test.txt
(和任何其他文件),而不仅仅是test_fold/
.