How to git diff only for modified files

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




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Kubernetes Basics for New Users

Async IO in Today’s Programming Languages

Pressure Pad Physics

Whitelist Amendments

TryHackMe: Git and Crumpets Walkthrough

Understanding Zeitwerk in Rails 6

How to port PostgreSQL db to SQLite db

ER diagrams vs. EER diagrams: what’s the difference?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Yann Eves

Yann Eves

More from Medium

Git:- Git is a distributed version control system for tracking changes in source code during…

Difference between XML and JSON (XML vs. JSON)

How to Rename Local and Remote Git Branch

Git checkout remote branch in one line