.gitignore Generator · Tutorial
How to write a .gitignore for a Python data project
5 min readbeginnerUpdated
Data projects fill up with virtual environments, notebook checkpoints, datasets and trained models that are far too big for git. You will build a .gitignore that skips them while keeping your code and notebooks.
What you need
- The .gitignore Generator
- A Python project, for example with Jupyter notebooks
Steps
Choose the templates
Load the example. It ticks Python for caches and virtual environments, Jupyter for checkpoints, plus VS Code, macOS, Windows and Secrets.
Add your data folders
Under Your own rules the example adds
data/raw/andmodels/*.pt. Change them to your own folders and file types, such as*.parquetorcheckpoints/.Check a large file
Type
data/raw/2026/sales.csvinto the path checker. It is ignored because the folderdata/raw/is ignored, so git won’t even look inside.Keep small sample data
To share a tiny sample, keep it in a separate folder such as
data/sample/, which isn’t ignored.!can’t bring back a file inside an ignored folder.
Try it yourself
Opens the .gitignore Generator with this tutorial's sample loaded.
Common mistakes
- Committing the virtual environment
- A
.venvfolder holds thousands of files that only work on your machine. Commitrequirements.txtorpyproject.tomlinstead. - Ignoring notebooks themselves
- Only the
.ipynb_checkpointsfolders are noise. Keep the.ipynbfiles, and clear large outputs before committing.
Next steps
Go back to the .gitignore Generator, or keep going with one of these: