问题
like the inverse of git diff --name-only
回答1:
You can do this by looking at unique values from ls-tree
and diff
with the --name-only
options (done in one line so it's easier to search and use from history later):
cat <(git ls-tree --name-only -r HEAD) <(git diff --name-only HEAD^ HEAD) | sort | uniq -u
In the example, the 2 revisions are HEAD and HEAD^. This produces no side effect output files.
回答2:
You could do this using the comm
command and some shell commands:
git ls-files >files.txt
git diff --name-only >diff.txt
comm -2 -3 files.txt diff.txt
来源:https://stackoverflow.com/questions/11496041/git-get-a-list-of-files-that-are-identical-between-two-revisions