我如何打印一份包含所有提交文件的简单列表?
尽管下面列出了这些文件,但它也包含了每个文件不需要的差异信息:
git show a303aa90779efdd2f6b9d90693e2cbbbe4613c1d
我如何打印一份包含所有提交文件的简单列表?
尽管下面列出了这些文件,但它也包含了每个文件不需要的差异信息:
git show a303aa90779efdd2f6b9d90693e2cbbbe4613c1d
当前回答
我使用此命令在合并提交中获取已更改文件的列表
λ git log -m -1 --name-only --pretty="format:"
configs/anotherconfig.xml
configs/configsInRepo.xml
or
λ git log -m -1 --name-status --pretty="format:"
A configs/anotherconfig.xml
M configs/configsInRepo.xml
其他回答
要列出特定提交时更改的文件,请执行以下操作:
git show --pretty=%gd --stat <commit_id>
要列出最近提交时更改的文件:
git show --pretty=%gd --stat
也许我错过了,有人提到过,如果您想使用“log”命令增加log x以前的提交,以包括受影响的文件的名称,然后在末尾添加--name。
so:
git log -n3
查看最后3次提交的最后评论。
git log -n3 --name-only
查看最近3次提交中生效的评论和文件。
我使用此命令获取两个变更集之间的已修改文件列表:
git diff --name-status <SHA1> <SHA2> | cut -f2
我经常使用更改后的别名。要设置它,请执行以下操作:
git config --global alias.changed 'show --pretty="format:" --name-only'
然后:
git changed (lists files modified in last commit)
git changed bAda55 (lists files modified in this commit)
git changed bAda55..ff0021 (lists files modified between those commits)
可能有用的类似命令:
git log --name-status --oneline (very similar, but shows what actually happened M/C/D)
git show --name-only
我个人在show命令中使用--stat和--oneline的组合:
git show --stat --oneline HEAD
git show --stat --oneline b24f5fb
git show --stat --oneline HEAD^^..HEAD
如果您不喜欢/不想要添加/删除统计信息,可以将--stat替换为--name only
git show --name-only --oneline HEAD
git show --name-only --oneline b24f5fb
git show --name-only --oneline HEAD^^..HEAD