V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
AndyAO
V2EX  ›  问与答

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

  •  1
     
  •   AndyAO · 2021-06-01 14:09:55 +08:00 · 666 次点击
    这是一个创建于 1057 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

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

    这个需求该怎么实现呢?

    3 条回复    2021-06-01 14:38:16 +08:00
    AoEiuV020
        1
    AoEiuV020  
       2021-06-01 14:21:21 +08:00
    显示文件夹意思是整个文件夹都没有添加到项目里吧,
    可以先搞个.gitignore,add 一下,再 status 就能看到文件夹里的其他文件了,
    littleylv
        2
    littleylv  
       2021-06-01 14:25:25 +08:00   ❤️ 1
    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
        3
    AndyAO  
    OP
       2021-06-01 14:38:16 +08:00
    @AoEiuV020 #1 其实可以使用 git status -uall
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   982 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 20:57 · PVG 04:57 · LAX 13:57 · JFK 16:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.