Use a .gitattributes file to mark files that match a given "pattern" with the specified attributes. A .gitattributes file uses the same rules for matching as .gitignore files. For more information, see PATTERN FORMAT in the Git documentation.
-
Unless the .gitattributes file already exists, create a .gitattributes file 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
Further reading
- Generated code in the Linguist documentation
- Creating new files