Skip to content
Edit this page View source of this page

Git ignore rules

The root .gitignore keeps untracked local artifacts out of Git's normal change list. It covers Python bytecode and caches, build output, test and coverage reports, local environments such as .venv/, .env files, and the generated documentation site under site/.

Find which rule matched

Run git check-ignore -v with a path to see the file, line, and rule responsible for ignoring it.

git check-ignore -v .venv/bin/python site/index.html
git status --short --ignored

If a file is already tracked, adding an ignore rule leaves it tracked. Review the index before changing how that file is handled. Files such as uv.lock and .python-version can be tracked because the corresponding examples in this template's ignore file are commented out.

Customize for your project

Add a rule for generated files your project introduces. Prefer a specific path such as /reports/ when only a root output directory should be ignored. Keep shared project configuration and source files in Git. Git ignore patterns