Skip to main content

Enterprise Server 3.20 目前作为发布候选版本提供。

自定义更改的文件在GitHub上的显示方式

若要使某些文件默认不显示在差异中,或不计入存储库语言统计,可以在 linguist-generated 文件中使用 ** 属性进行标记。

使用“.gitattributes”文件来通过指定的属性标记与给定“模式”匹配的文件。 “.gitattributes”文件使用与“.gitignore”文件匹配的同一规则。 有关详细信息,请参阅 Git 文档中的 PATTERN FORMAT

  1. 除非“.gitattributes”文件已存在,否则请在存储库的根目录中创建一个“.gitattributes”文件 。

  2. 使用 linguist-generated 属性标记或取消标记要根据存储库的语言统计数据而忽略或默认隐藏差异的路径。

    例如,若要将 search/index.json 标记为生成的文件,请将此行添加到“.gitattributes”:

    search/index.json linguist-generated
    

    若要取消标记通常被视为_已生成_的文件,请在 .gitattributes 中添加以下行:

    bootstrap.min.css -linguist-generated
    

其他阅读材料

  • Linguist 文档中的生成的代码
  •         [AUTOTITLE](/repositories/working-with-files/managing-files/creating-new-files)