Skip to main content

Bad Diff vs Good Diff

Bad Diff

Here's an example of a diff that contains style changes at the same time as a functional change:change. Can you find the needle in the haystack:

image.png

Good luck finding what changed. Could you approve that code review saying you understand what happened with a straight face?
And It'that's a needlesimple inexample, ait haystack.gets much worse.

Good Diff

Here's the exact same functional change without the style changes:

image.png

Not only does this make way more sense to look at, but it also ensures that there will be far fewer merge conflicts because your changes only touch one area of the code.