【问题标题】:git list files that are fully stagedgit 列出完全暂存的文件
【发布时间】:2014-10-29 18:13:08
【问题描述】:

是否有 git 命令列出已完全暂存的文件?我知道 git diff --name-only (有和没有 --cahced 以查看未暂存/暂存的),但我想要一个完全暂存的文件列表,其中没有未暂存的更改。

【问题讨论】:

  • 您想要git diff --name-only --cached 列出但git diff --name-only 未列出的文件集?

标签: git shell command-line


【解决方案1】:

使用 comm 程序从暂存区和工作目录过滤文件列表的输出。

comm -23 <(git diff --cached --name-only) <(git diff --name-only)

然后将其别名为git fully-staged 或其他名称。

【讨论】:

    【解决方案2】:

    我相信你想要git status --porcelain

    git status --porcelain | grep '^[^ ] ' | cut -d ' ' -f 2
    

    来自man page

    --瓷器

    Give the output in an easy-to-parse format for scripts. This is similar to the short output, but will remain stable across Git
    

    版本,无论用户配置如何。详情见下文。

    还有文档后面的Short FormatPorcelain Format 部分。

    【讨论】:

      猜你喜欢
      • 2016-02-10
      • 1970-01-01
      • 2019-05-06
      • 2011-04-12
      • 2014-02-16
      • 1970-01-01
      • 2015-09-11
      • 1970-01-01
      • 2021-07-23
      相关资源
      最近更新 更多