Ensure a .gitignore file is included in projects
  • Updated on 06 May 2019
  • 1 minute to read
  • Contributors
  • Share
  • Dark
    Light

Ensure a .gitignore file is included in projects

  • Share
  • Dark
    Light

This rule makes sure a .gitignore file is included inside the repository.

A repository should contain a .gitignore file to ensure predefined files and directories are ignored from being tracked by Git and therefore, won't be committed to the codebase.

Use case(s)

  • Prevention of human errors in your codebase
  • Ensuring appropriate commits and source control additions

When does this rule fail?

When submitting a pull request to a repository w/o a '.gitignore' file in the root directory.

3x-020db8e-Screen_Shot_2019-01-16_at_19.28.59.png

How to fix?

  1. Create a meaningful .gitignore file according to your repository requirements
  2. Commit and push the new .gitignore file to your branch
  3. Datree's policy check automatically ensures the pull request includes a .gitignore file


What's Next

Activate a policy
Was this article helpful?