git - 显示最近 x 次提交中更改/添加/删除的所有文件的列表
问题描述
我想列出最近 X 提交中更改的所有文件。
我试过:
git log --name-status -10
但它也会记录其他信息,如提交 ID、作者、日期等。我只需要文件名。有没有实现这一点的命令?
编辑:
此编辑应解释为什么我的问题与“如何仅列出在两次提交之间更改的文件名?”的重复项?正如用户 phd 声称的那样。
我不认为我必须解释它,很明显这是两个完全不同的问题。我问如何创建最后 x 次提交的列表,而“重复”则询问提交 A 和 B 之间的提交列表。
解决方案
我更喜欢git diff
在这里使用:
git diff --name-only HEAD~10.. --
在 Python 存储库中的一个标签上,这产生了:
$ git diff --name-only HEAD~10.. --
Doc/library/http.client.rst
Doc/library/tkinter.rst
Include/patchlevel.h
Lib/http/client.py
Lib/ssl.py
Lib/test/libregrtest/setup.py
Lib/test/test_httplib.py
Lib/test/test_ssl.py
Lib/test/test_syntax.py
Mac/BuildScript/resources/ReadMe.rtf
Mac/BuildScript/resources/Welcome.rtf
Misc/NEWS.d/3.7.4.rst
Misc/NEWS.d/3.7.4rc1.rst
Misc/NEWS.d/3.7.4rc2.rst
Misc/NEWS.d/next/Core and Builtins/2019-06-22-12-45-20.bpo-24214.hIiHeD.rst
Misc/NEWS.d/next/Library/2019-02-03-19-13-08.bpo-32627.b68f64.rst
Misc/NEWS.d/next/Library/2019-06-27-13-27-02.bpo-37428._wcwUd.rst
Misc/NEWS.d/next/Library/2019-06-27-20-33-50.bpo-37437.du39_A.rst
Misc/NEWS.d/next/Windows/2019-06-18-09-05-08.bpo-35360.tdqSmo.rst
Misc/NEWS.d/next/Windows/2019-06-28-08-09-08.bpo-37369.1iVpxq.rst
Modules/expat/expat_external.h
Python/compile.c
Python/peephole.c
README.rst
configure
configure.ac
如果您想要状态,您也可以使用该--name-status
选项diff
:
git diff --name-status HEAD~10.. --
这是上面带有--name-status
选项的示例:
$ git diff --name-only HEAD~10.. --
M Doc/library/http.client.rst
M Doc/library/tkinter.rst
M Include/patchlevel.h
M Lib/http/client.py
M Lib/ssl.py
M Lib/test/libregrtest/setup.py
M Lib/test/test_httplib.py
M Lib/test/test_ssl.py
M Lib/test/test_syntax.py
M Mac/BuildScript/resources/ReadMe.rtf
M Mac/BuildScript/resources/Welcome.rtf
A Misc/NEWS.d/3.7.4.rst
M Misc/NEWS.d/3.7.4rc1.rst
A Misc/NEWS.d/3.7.4rc2.rst
D Misc/NEWS.d/next/Core and Builtins/2019-06-22-12-45-20.bpo-24214.hIiHeD.rst
D Misc/NEWS.d/next/Library/2019-02-03-19-13-08.bpo-32627.b68f64.rst
D Misc/NEWS.d/next/Library/2019-06-27-13-27-02.bpo-37428._wcwUd.rst
D Misc/NEWS.d/next/Library/2019-06-27-20-33-50.bpo-37437.du39_A.rst
D Misc/NEWS.d/next/Windows/2019-06-18-09-05-08.bpo-35360.tdqSmo.rst
D Misc/NEWS.d/next/Windows/2019-06-28-08-09-08.bpo-37369.1iVpxq.rst
M Modules/expat/expat_external.h
M Python/compile.c
M Python/peephole.c
M README.rst
M configure
M configure.ac
就个人而言,我更喜欢使用--stat
来查看有关更改的一些统计信息,如果它是由我使用而不是脚本:
git diff --stat HEAD~10.. --
这是上面的相同示例--stat
:
$ git diff --stat HEAD~10.. --
Doc/library/http.client.rst | 5 ++
Doc/library/tkinter.rst | 4 +-
Include/patchlevel.h | 6 +-
Lib/http/client.py | 7 ++
Lib/ssl.py | 29 ++++---
Lib/test/libregrtest/setup.py | 16 ----
Lib/test/test_httplib.py | 18 +++++
Lib/test/test_ssl.py | 9 ++-
Lib/test/test_syntax.py | 14 ----
Mac/BuildScript/resources/ReadMe.rtf | 8 +-
Mac/BuildScript/resources/Welcome.rtf | 4 +-
Misc/NEWS.d/3.7.4.rst | 19 +++++
Misc/NEWS.d/3.7.4rc1.rst | 2 +-
Misc/NEWS.d/3.7.4rc2.rst | 90 ++++++++++++++++++++++
.../2019-06-22-12-45-20.bpo-24214.hIiHeD.rst | 2 -
.../2019-02-03-19-13-08.bpo-32627.b68f64.rst | 1 -
.../2019-06-27-13-27-02.bpo-37428._wcwUd.rst | 4 -
.../2019-06-27-20-33-50.bpo-37437.du39_A.rst | 1 -
.../2019-06-18-09-05-08.bpo-35360.tdqSmo.rst | 1 -
.../2019-06-28-08-09-08.bpo-37369.1iVpxq.rst | 1 -
Modules/expat/expat_external.h | 4 +
Python/compile.c | 9 ++-
Python/peephole.c | 15 +---
README.rst | 4 +-
configure | 6 ++
configure.ac | 6 ++
26 files changed, 209 insertions(+), 76 deletions(-)
(注意:输出将根据最后一个版本的终端调整宽度)
推荐阅读
- wordpress - WordPress No sound in header youtube video on Frontpage
- sqlite - Mystery of the invisible MsgBox 50 in AutoHotKey
- php - 删除 WooCommerce 中管理员的“客户付款页面”限制(pay_for_order 功能?)
- angular - Handle ul menu with angular 7
- join - 使用 forEach 加入方法——最佳实践?
- javascript - svg.js 在路径中间定位文本
- php - PHP shopping cart with cookies
- python - http流感季节问题python不确定为什么我得到这个输出
- html - Hover effect on image with text
- simulink - Simulink 中的 FMI 协同仿真运行时错误