GitHub gitignore Templates

repository·main·Indexed 13 days ago

https://github.com/github/gitignore

A curated collection of .gitignore templates for various programming languages, frameworks, operating systems, and editors. Includes global templates for OS and editor files, mainstream language templates in the root directory, and specialized templates in the community directory.

Tokens
811
Snippets
1
Records
4
Agent score
50%

What's inside GitHub gitignore

  1. Understand the .gitignore template organization

    main

    The templates in this repository are organized into three distinct tiers based on their scope and usage frequency:

    • Root directory: Contains templates for mainstream programming languages and technologies. These are intended to be used directly in your project's .gitignore file to prevent committing unimportant files.
    • Global/ directory: Contains templates for editors, tools, and operating systems. It is recommended to either add these to your global git configuration or merge these rules into your project-specific templates.
    • community/ directory: Contains specialized templates for less mainstream languages, tools, or specific versions of software. These should be added to your project-specific templates when you adopt the corresponding framework or tool.
  2. How to contribute a new .gitignore template

    main

    To propose a new template, follow these steps:

    1. Determine the location:
      • If it is a mainstream language/tool, target the root.
      • If it is a specialized or less common tool, place it in the community/ directory under an appropriate folder.
      • If the template is version-specific, the current version should be at the root (without a version in the filename), and older versions should live in community/ with the version embedded in the filename.
    2. Follow the workflow:
      • Fork the repository.
      • Create a new branch.
      • Apply your changes.
      • Submit a pull request to the main branch.

    Note: A good template should provide a curated, small set of useful rules for a specific environment rather than an exhaustive list of every file installed by a software version.

  3. Use globally useful gitignores for OS and editor files

    main
    The Global/ directory in this repository contains .gitignore templates that are useful across all your projects, such as those for specific Operating Systems (OS) or code editors. Instead of adding these to every individual project, you can configure Git to use them globally for all repositories on your computer.
  4. Format specialized templates for the community directory

    main

    When contributing a specialized template to the community/ directory, ensure the rules are specific to the framework or tool. It is recommended to include metadata in the header comments, such as the template's purpose and related recommended templates.

    Example structure for community/DotNet/InforCRM.gitignore:

    # gitignore template for InforCRM (formerly SalesLogix)
    # website: https://www.infor.com/product-summary/cx/infor-crm/
    #
    # Recommended: VisualStudio.gitignore
    
    # Ignore model files that are auto-generated
    ModelIndex.xml
    ExportedFiles.xml
    
    # Ignore deployment files
    [Mm]odel/[Dd]eployment
    
    # Force include portal SupportFiles
    !Model/Portal/*/SupportFiles/[Bb]in/
    !Model/Portal/PortalTemplates/*/SupportFiles/[Bb]in