git status不显示新添加的文件夹的内容 [英] git status not showing contents of newly added folder

查看:1256
本文介绍了git status不显示新添加的文件夹的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在/处创建了一个新的git repo,我在 test_fold 文件夹中创建了一个新文件 test.txt 该文件为 test_fold \ test.txt .然后,我运行 git status .这是输出,它找到文件夹而不是文件.为什么不告诉我 test_fold 中有一个新文件?

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?

$ 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 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 status 产生大量输出.默认情况下,仅显示顶级未跟踪路径会带来更清晰的输出.

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向您显示文件夹的内容,请使用

If you want Git to show you the content of the folder, use

$ git status -uall

这将向您显示 test_fold/test.txt (以及其他任何文件),而不只是 test_fold/.

This will show you test_fold/test.txt (and any other files) instead of just test_fold/.

这篇关于git status不显示新添加的文件夹的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆