简体   繁体   English

如何在不进行暂存的情况下查看git中新创建的文件的列表?

[英]How can I see a list of my newly-created files in git without staging them for commit?

When I create a new file in a local git repo, it doesn't show up in the output of git status unless I add it via git add . 当我在本地git repo中创建一个新文件时,除非通过git add添加它,否则它不会显示在git status的输出中。 Then it will show up under the files that are staged for commit. 然后它将显示在准备提交的文件下。

When I do a git reset , files that already exist in the remote repo will show up under unstaged files but newly-created ones will not show up at all. 当我执行git reset ,远程存储库中已经存在的文件将显示在未暂存的文件下,但是新创建的文件将根本不显示。

My question is this: Is there a way to show newly-created files in the output of git status without staging them for commit? 我的问题是:是否有一种方法可以在git status的输出中显示新创建的文件,而无需暂存它们以进行提交? And if not, is there a "right"--or indeed, any--way of having them show up in the output, without staging them, so I can keep track of which files I created? 如果没有,是否有一种“正确的”(或者实际上是任何一种)方式使它们显示在输出中而不进行暂存,因此我可以跟踪创建的文件吗?

git status -u is what you need. git status -u是您所需要的。 You can add "all" ( git status -uall ) for extra detail. 您可以添加“全部”( git status -uall )以获取更多详细信息。

The config option is status.showUntrackedFiles . config选项为status.showUntrackedFiles So if you want to permanently change what you see, try one of these: 因此,如果您想永久更改看到的内容,请尝试以下方法之一:

git config --global status.showUntrackedFiles normal
git config --global status.showUntrackedFiles all

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM