Git diff hide package-lock files

Do you really need to see a billion lines of diff in a package-lock.json file? I know I rarely benefit from seeing the diff. Wouldn't it be great if those were just collapsed when you run git diff in the terminal? Lets make it happen.

Git diff hide package-lock files

Do you really need to see a billion lines of diff in a `package-lock.json` file? I know I rarely benefit from seeing the diff. Wouldn't it be great if those were just collapsed when you run git diff in the terminal? Lets make it happen.

Create a .gitattributes file

touch ~/.gitattributes

Add Content to the file

Add the following lines the file to collapse package-lock.json files from diffs.

# Exclude package-lock from git diff
**/package-lock.json -diff

Configure Git to use the new configuration

Tell Git to use the new .gitattributes file

git config --global core.attributesFile "~/.gitattributes"