Search code examples
githubgithub-enterprise

How to expand package-lock.json diffs in github by default using .gitattributes


By default, the Github web UI collapses changes to package-lock.json files. I understand why most people would prefer this, but I'm working on a project where we would prefer to see the changes expanded.

Searching around, I'm guessing that I need to use the Linguist language in a .gitattributes file, but I haven't had any luck finding examples or doc on how to express this. All blog posts and questions I find are targetted the opposite way (how to hide, ignore, merge changes to this file).

Does anyone know how to tell Github that I want to see changes to my package-lock.json file expanded in the UI? We use Github Enterprise at work, so hopefully the answer isn't any different there.


Solution

  • With help from someone on the Linguist project, I learned that the .gitattributes syntax looks like this:

    package-lock.json linguist-generated=false