markdown 显示在特定git提交中更改的文件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 显示在特定git提交中更改的文件相关的知识,希望对你有一定的参考价值。

## The one I want to use 95% of the time:
`git diff-tree --no-commit-id --name-status -r <commit-ish>`

---


From StackOverflow's [How to list all the files in a commit?
](https://stackoverflow.com/questions/424071/how-to-list-all-the-files-in-a-commit):

### Preferred Way (because it's a plumbing command; meant to be programmatic):

```bash
$ 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)

```bash
$ 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.
*   The --name-status argument shows the file names and how they were changed
*   The -r argument is to recurse into sub-trees

----

If you want to get list of changed files:
`git diff-tree --no-commit-id --name-only -r <commit-ish>`

If you want to get list of all files in a commit, you can use
`git ls-tree --name-only -r <commit-ish>`

If you want to get a list of all new files in a commit, you can use:
`git diff-tree -r --name-only --no-commit-id --diff-filter=A <commit-ish>`

以上是关于markdown 显示在特定git提交中更改的文件的主要内容,如果未能解决你的问题,请参考以下文章

Git status - 有没有办法只在特定目录中显示更改?

有啥方法可以在特定时间自动提交 git 中的更改

如何从特定修订版更改 GIT 中提交的作者 [重复]

如何 git 还原一个特定文件的更改,而我的提交更改也涉及其他文件? [复制]

如何运行 git log 以仅查看特定分支的更改?

markdown 如何在Git中更改提交消息? - 首次发表于fullweb.io第55期