How to list only the names of files that changed between two commits

git, git-diff

Solution

git diff --name-only SHA1 SHA2

where you only need to include enough of the SHA hash to identify the commits. The order of the SHAs does not matter. The output (which includes the relative path, not just the file name) follows this format:

 dir 1/dir 2/filename.ext
 dir 3/dir 4/other filename.ext

You can also do, for example

git diff --name-only HEAD~10 HEAD~5

to see the differences between the tenth latest commit and the fifth latest (or so).

Problem

I have a bunch of commits in the repository. I want to see a list of files changed between two commits - from SHA1 to SHA2. What command should I use?

Original source

Related problems