Github supports this now with a .gitattributes file.
-
Create a
.gitattributesfile in the root of the repository. -
Use the linguist-generated attribute to mark or unmark paths that you would like to be ignored for the repository’s language statistics and hidden by default in diffs.
For example, to mark search/index.json as a generated file, add this line to .gitattributes:
search/index.json linguist-generated=true
Reference: https://help.github.com/en/github/administering-a-repository/customizing-how-changed-files-appear-on-github