How to git diff only for modified files

Yann Eves
1 min readMay 7, 2020

--

While doing some diagnostic work today to determine changes within a big directory of code across two versions, I wanted to remove the noise to see only the modified files in a git diff. After a quick search around, I found myself in the Git documentation scrolling through command options.

And there I found it, a flag --diff-filter.

To diff some changes but only show modified files, use

git diff --diff-filter=M

Or to just remove added and deleted files, to keep changes like rename or unmerged, the lowercase works as an inverted filter; a == !A.

git diff --diff-filter=ad

--

--