源站: 老姜博客 Git之改动文件清单
方法一
格式: git diff --name-only [SHA1 [SHA2]]
示例:
$ git diff --name-only HEAD~5 HEAD
docs/.vuepress/config.js
docs/README.md
docs/css/23-transform.md
docs/css/24-box-sizing.md
docs/frontend/css.md
docs/frontend/vue.md
方法二
格式: git log --name-status --oneline [SHA1..SHA2]
该命令比上面的命令拆分的细一些,基于commit进行分组,同时对于每个文件的改动类型进行说明
示例:
$ git log --name-status --oneline HEAD~5 HEAD
d932af8 (HEAD -> master, origin/master) fix
M docs/css/23-transform.md
M docs/css/24-box-sizing.md
M docs/frontend/vue.md
30751f4 disqus
M docs/css/24-box-sizing.md
2fd83d9 css box-sizing
M docs/.vuepress/config.js
M docs/README.md
A docs/css/24-box-sizing.md
M docs/frontend/css.md
5ccbaa2 fix
M docs/css/23-transform.md
34f5d25 补充示例
M docs/css/23-transform.md
57def33 新增css transform
M docs/.vuepress/config.js
M docs/README.md
A docs/css/23-transform.md
M docs/frontend/css.md
改动清单前缀符解释如下:
- M modified - File has been modified
- C copy-edit - File has been copied and modified
- R rename-edit - File has been renamed and modified
- A added - File has been added
- D deleted - File has been deleted
- U unmerged - File has conflicts after a merge