How to Get a list of the changed files in Git

Reginald LynchOctober 31st 2020, 1:10

The same repository and HEAD position (HEAD pointing to 93da791) that we saw in the previous post will be used. The release is also the same, which is v5.8.1.202007141445-r.

Step 1 : The following command lists all the files that have changed since the last release (v5.8.1.202007141445-r)

git diff --name-only v5.8.1.202007141445-r..HEAD

By specifying --name-only, Git will only give the paths of the files that were changed by the commits in the range specified as output.

Step 2 : The output of the command can be further filtered: If we only want to show which files have been deleted in the repository since the last commit, we can use the --diff-filter switch with git diff:

git diff --name-only --diff-filter=D v5.5.0.201909041048-rc1..HEAD

There are also switches for the files that have been added (A), copied (C), deleted (D), modified (M), renamed (R), and so on