d
Amit DhamuSoftware Engineer
 

Hide Minified File Contents From Git History

1 minute read 00000 views

Compiled JavaScript and CSS files can litter git diffs and logs and make it hard to determine what exactly has changed. Instead, developers should refer to the source files for changes rather than the compiled ones.

In order to do this, add the following to your .gitattributes file.

# <file> -diff
styles.min.css -diff
script.min.js -diff

This essentially marks the said files as binary and a git diff will simply state they differ rather than showing any code changes.