Git – get a list of files that are identical between two revisions

like the inverse of git diff --name-only

  • Why git cheats with clean command?
  • How does git keep track of versions in the remote repository?
  • Git Plugin parameter for branch and repository urls?
  • Why is git not ignoring .dcu files?
  • How to use PyCharm as a GIT diff tool from the command line?
  • Alternative to git ls-tree -r HEAD — . :!foo
  • Gitflow + Forking workflow (on Stash)?
  • Pip doesn't install packages to activated virtualenv, ignores requirements.txt
  • Using libgit2 C API within Visual Studio 2013
  • What is the .git/branches folder used for?
  • Pull Requests for orphan branch
  • Is it possible to git reset as a new commit?
  • 2 Solutions collect form web for “Git – get a list of files that are identical between two revisions”

    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.

    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
    Git Baby is a git and github fan, let's start git clone.