Andrei Calazans

Git diff file filtering

☕️ 1 min read

Today I Learned

Today I learned that when diffing between two branches you can apply file filters to both exclude or include files.

I needed to diff between two release branches and I was only interested in changes within tsx files so I did:

Git diff origin/release-app-10.35.x..origin/release-app-10.36.x ':(exclude)*.test.tsx' *.tsx'

Few things to note:

1) This :(exclude) tag serve as a match to exclude files.

2) Git diff actually takes multiple matches so you could do git diff *.tsx *.js for instance.

I can see how this will be very useful for me when I need to see what changes happened within a folder too.