【问题标题】:How to list all files for specific commit?如何列出特定提交的所有文件?
【发布时间】:2013-09-28 10:20:36
【问题描述】:

对于特定的提交,我想查看哪些文件已被修改/添加。是否有一个 git 命令可以列出所有为特定提交而修改/添加的文件?

【问题讨论】:

标签: git git-commit


【解决方案1】:

使用

git diff {commit} {commit}^ --name-only

【讨论】:

  • 这看起来比我的回答更“gitish”;)
  • 当然,也许我的语法不够清楚,抱歉;大括号仅用于表示提交,例如,如果游览提交 SHA 将其截断为 cf23df:git diff cf23df cf23df^ --name-only
【解决方案2】:

使用 git-whatchanged

参见 git-whatchanged(1) 手册页。例如:

$ git whatchanged --max-count=1 76ca0a8
commit 76ca0a8d36ad764cae050430c63b0cbc28e6493f
Author: John Doe <john.doe@example.com>
Date:   Mon Sep 16 12:23:42 2013 -0400

    Add Ruby version and gemset files.

:000000 100644 0000000... eaec1d0... A  .ruby-gemset
:000000 100644 0000000... abf2cce... A  .ruby-version

底部带有冒号的行显示添加、修改、删除或其他任何内容的文件。另请参阅 git-log(1) 中定义的--name-only 标志,以获得与提交相关的文件名列表。

【讨论】:

猜你喜欢
  • 2011-04-11
  • 2014-09-11
  • 2021-10-08
  • 2014-07-07
  • 2023-03-27
  • 1970-01-01
相关资源
最近更新 更多