👋 We've unified all of GitHub's product documentation in one place! Check out the content for REST API, GraphQL API, and Developers. Learn more on the GitHub blog.

This version of GitHub Enterprise will be discontinued on This version of GitHub Enterprise was discontinued on 2020-08-20. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise. For help with the upgrade, contact GitHub Enterprise support.

Article version: Enterprise Server 2.18

Customizing how changed files appear on GitHub

To keep certain files from displaying in diffs by default, or counting toward the repository language, you can mark them with the linguist-generated attribute in a .gitattributes file.

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.

  1. Unless the .gitattributes file already exists, create a .gitattributes file in the root of the repository.

  2. 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

Ask a human

Can't find what you're looking for?

Contact us