DEV Community

Maximilian Koch
Maximilian Koch

Posted on

Show me your .gitignore

The .gitignore file exists in almost every of our projects, but even across similar projects the .gitignore always looks different.

Cheers

Latest comments (22)

Collapse
 
bayuangora profile image
Bayu Angora

/public/

Collapse
 
nasa9084 profile image
nasa9084

I'm using gitignore.io, like below (when I write Go):

$ gi macos,emacs,go

gi is wrapper function, written in gitignore.io 's document.

Collapse
 
munkacsimark profile image
Márk Munkácsi

Check out this tool: gitignore.io/ 🦄

Collapse
 
evanoman profile image
Evan Oman • Edited

I mostly generate mine with joe, I highly recommend it. joe is a cli tool which generates .gitignore files given a list of tools/languages you plan to use.

So for my current project I did joe g java jetbrains vim gradle > .gitignore and I was all set!

Collapse
 
equiman profile image
Camilo Martinez

gitignore.io just type the kind of project/tool and it generate the "perfect" gitignore for you

Collapse
 
fengshangwuqi profile image
枫上雾棋 • Edited
# log
*.log

# Runtime data
.DS_Store
*.pid

# dependencies
node_modules

build

#test
coverage

yarn.lock

*.idea/
.vscode/
.agignore
Collapse
 
ghost profile image
Ghost

I like to have two .gitignore, one for me (a global one), and one for the project that I'm working on.

In my global gitignore, named .gitexcludes(github.com/diegoholiveira/dotfiles...), I ignore files that are generated by my own environment, like IDEs files, vagrant files and others.

In my projects, my .gitignore only have entries that are directly about the project: like build files, pyc files and vendor folder, generated files and other.

This helps me to keep things very organized.

Collapse
 
oleksiyrudenko profile image
Oleksiy Rudenko

A really great approach! You must be a good project collaboration mate.
Cheers!

Collapse
 
rmawhinnie profile image
Randall Mawhinnie

Byte-compiled / optimized / DLL files

pycache/
*.py[cod]
*$py.class

Database files

*.db

C extensions

*.so

Distribution / packaging

.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

PyInstaller

Usually these files are written by a python script from a template

before PyInstaller builds the exe, so as to inject date/other infos into it.

*.manifest
*.spec

Installer logs

pip-log.txt
pip-delete-this-directory.txt

Unit test / coverage reports

htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

Translations

*.mo
*.pot

Django stuff:

*.log
.static_storage/
.media/
local_settings.py

Flask stuff:

instance/
.webassets-cache

Scrapy stuff:

.scrapy

Sphinx documentation

docs/_build/

PyBuilder

target/

Jupyter Notebook

.ipynb_checkpoints

pyenv

.python-version

celery beat schedule file

celerybeat-schedule

SageMath parsed files

*.sage.py

Environments

.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

Spyder project settings

.spyderproject
.spyproject

Rope project settings

.ropeproject

mkdocs documentation

/site

mypy

.mypy_cache/

Collapse
 
ycmjason profile image
YCM Jason

Can I do a promote a tool here for those who like building random projects?

npmjs.com/package/gitignorer

It is a tool that allow you to init gitignore file easily given a default profile.

Collapse
 
vancanhuit profile image
Đinh Văn Cảnh

When I start a project, I go to this site to create .gitignore.