git ls-tree -r --name-only $REV 例如git ls-tree -r --name-only a27689bf7f46dc0735c5b3b6076010c87224063e
ls-files --with-tree
将产生一个列表,其中包含索引或指定树对象中的所有路径名。例如:假设newfile
目前没有被跟踪。touch newfile && git add newfile && git commit -mnewfile && git ls-tree --with-tree=HEAD~
将显示newfile
,即使它不在 HEAD~ 中。ls-files
真正关注的是索引和工作树。使用ls-tree
检查树对象(树、提交、标签)的内容。 - Chris Johnsen