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

like the inverse of git diff --name-only

  • why does bare repository have HEAD
  • Git workflow tips
  • Compiling workflow with version control
  • How do I check in files for building with git?
  • Can't clone remote git repository with EGit
  • Export every revision of a single file from a Git repository?
  • change the data directory gitlab to store repos elsewhere
  • Setting diffmerge as visual Git difftool not working
  • How do I add a git submodule that has no master branch?
  • Git auto-pull using cronjob
  • Magit : how to see log between 2 points
  • Where does git store information about the origin of a repository
  • 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.