如何在 git status 中显示具体文件而非不是文件夹?

2021-06-01 14:09:55 +08:00
 AndyAO

有时候想具体看看文件夹中到底有什么文件处于??状态,但 git status 有时候只会显示文件夹,而不是里面的具体内容。

假如文件夹为a,使用git status a也看不到里面的内容,将那个文件夹设为工作目录也不行,查看 git status 相关的文档也没有找到相关选项或者是配置方法。

这个需求该怎么实现呢?

698 次点击
所在节点    问与答
3 条回复
AoEiuV020
2021-06-01 14:21:21 +08:00
显示文件夹意思是整个文件夹都没有添加到项目里吧,
可以先搞个.gitignore,add 一下,再 status 就能看到文件夹里的其他文件了,
littleylv
2021-06-01 14:25:25 +08:00
git st:
a
b/

git st -uall:
a
b/bb

但凡你仔细看看 git help status 都可以看到这个参数:
-u[<mode>], --untracked-files[=<mode>]
Show untracked files.

The mode parameter is used to specify the handling of untracked
files. It is optional: it defaults to all, and if specified, it
must be stuck to the option (e.g. -uno, but not -u no).

The possible options are:

o no - Show no untracked files.

o normal - Shows untracked files and directories.

o all - Also shows individual files in untracked directories.
AndyAO
2021-06-01 14:38:16 +08:00
@AoEiuV020 #1 其实可以使用 git status -uall

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/780611

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX