我如何打印一份包含所有提交文件的简单列表?
尽管下面列出了这些文件,但它也包含了每个文件不需要的差异信息:
git show a303aa90779efdd2f6b9d90693e2cbbbe4613c1d
我如何打印一份包含所有提交文件的简单列表?
尽管下面列出了这些文件,但它也包含了每个文件不需要的差异信息:
git show a303aa90779efdd2f6b9d90693e2cbbbe4613c1d
当前回答
我找到了一个完美的答案:
git show --name-status --oneline <commit-hash>
这样我就能知道
刚刚修改了哪些文件(M)新添加的文件(A)删除了哪些文件(D)
其他回答
$ git log 88ee8^..88ee8 --name-only --pretty="format:"
“gitshow--stat”(谢谢Ryan)和几个sed命令的组合应该可以为您减少数据:
git show --stat <SHA1> | sed -n "/ [\w]\*|/p" | sed "s/|.\*$//"
这将只生成已修改文件的列表。
我经常使用更改后的别名。要设置它,请执行以下操作:
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
我喜欢使用
git show --stat <SHA1>^..<SHA2>
Use
git log --name-status
这将显示提交id、消息、更改的文件以及是否修改、创建、添加或删除。有点像是一个万能的命令。