如何列出提交中的所有文件? [英] How to list all the files in a commit?
问题描述
我正在寻找一个简单的 git
命令,它提供了一个格式良好的所有文件列表,这些文件是散列(SHA1)提交的一部分,没有多余
我试过了: $ b
尽管它列出了这些文件,但它还包含了各种不需要的差异信息。
是否有另外一个 git
命令会提供我想要的列表,这样我就可以避免从 git中解析它显示
输出?
首选方式 > plumbing 命令;应该是程序化的):
$ git diff-tree --no-commit-id --name-only -r bd61ad98
index.html
javascript / application.js
javascript / ie6.js
另一种方式(脚本不太受欢迎,因为它是瓷器命令;这意味着面向用户)
$ git show --pretty = - 仅限名称bd61ad98
index.html
javascript / application.js
javascript / ie6.js
$ b
-
- no-commit-id
取消提交ID输出。 b $ b -
- pretty
参数指定一个空的格式字符串以避免在开始处发生错误。 -
- 仅限名称
参数仅显示受影响的文件名(谢谢Hank)。
- r
参数是递归到子树中
I am looking for a simple git
command that provides a nicely formatted list of all files that were part of the commit given by a hash (SHA1), with no extraneous information.
I have tried:
git show a303aa90779efdd2f6b9d90693e2cbbbe4613c1d
Although it lists the files, it also includes unwanted diff information for each.
Is there another git
command that will provide just the list I want, so that I can avoid parsing it from the git show
output?
Preferred Way (because it's a plumbing command; meant to be programmatic):
$ git diff-tree --no-commit-id --name-only -r bd61ad98
index.html
javascript/application.js
javascript/ie6.js
Another Way (less preferred for scripts, because it's a porcelain command; meant to be user-facing)
$ git show --pretty="" --name-only bd61ad98
index.html
javascript/application.js
javascript/ie6.js
- The
--no-commit-id
suppresses the commit ID output. - The
--pretty
argument specifies an empty format string to avoid the cruft at the beginning. - The
--name-only
argument shows only the file names that were affected (Thanks Hank). - The
-r
argument is to recurse into sub-trees
这篇关于如何列出提交中的所有文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!