markdown guide
 

Every time I start a new project I just download a .gitignore from Github/gitignore

Recently I found out there's a VSCode extension which does that for me.

 

I feel like I saw this before, but this is a great resource. Thanks!

 

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

 

Since I'm using JetBrains's IntellIJ IDEA most the time, my .gitignore is normally just:

.idea/
*.iml

This makes sure I'm not committing any IDE generated files on my Java/Kotlin projects.

For those who might not be familiar with the *.iml, it tells Git to ignore any files names that end on .iml. This can be done to any kind of files too.

 
.DS_Store
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
node_modules
.directory
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
Session.vim
play.js
coverage
out
.nyc_output
docs/_site
docs/.sass-cache
.vscode

The first 2/3 or more dates from before I took over the project, so now I'm curious what those regexes are doing...

 
 
# Ignore bundler config.
/.bundle

# Ignore all logfiles and tempfiles.
/log/*
!/log/.keep
/tmp
.DS_Store
.swp
.approvals
.torus.json
coverage
/tags

#Ignore public uploads
/public/uploads/*
/public/c/*
/public/i/*
/public/assets/*

#Ignore node_modules
node_modules/

# Generated js bundles
/app/assets/javascripts/generated/*
latest.dump
.byebug_history

# Ignore application configuration
/config/application.yml
/public/packs
/public/packs-test
/node_modules
 

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.

 

Mine's pretty simple, for my apps.nektro.net project this is it

/node_modules/
/bin/
 

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.

 

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

 

gitignore

Gitignore for my $HOME directory (inverse of the usual, ignore everything except some files) and a typical project (with a bunch of project specific files)

 

Why do you need a gitignore for your $HOME?do you use this as a template?

 

For provisioning and syncing between computers. I keep my $HOME directory in source control, just the files listed there (probably unwise to store .ssh in source control). Since I use the same settings (bashrc, bash_aliases, vim settings) between my desktop, laptop, server, and phone, I keep these in source control.

This also means that if I want to do a clean upgrade (complete reinstall without keeping junk) I can quickly get a new setup and I'm up and running. I only do this once a year or so, but on several different computers it just makes the process easier.

I also have a separate .config in source control (see below), since my phone doesn't need that, and a headless server wouldn't need the same GUI config files.

This is also useful for keeping productivity tools, scripts, settings all in one place. The company I worked for before set me up with a laptop so it was just a matter of installing git and running a couple commands to optimize my workflow.

I used to only have one for ~/bin, since I have a few hundred bash scripts in there (only use about 20 regularly), but I soon expanded to most of my home directory after a few reinstalls.

*
!.gitignore
!user-dirs.dirs
!gtk-3.0/
!gtk-3.0/**/*
!google-chrome/
!google-chrome/Default/
!google-chrome/Default/Bookmarks
!mc/
!mc/**/*
!sublime-text-3/
!sublime-text-3/Packages/
!sublime-text-3/Packages/User/
!sublime-text-3/Packages/User/**/*
 

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!

 

My Rails 5 app:

# Ignore bundler config.
/.bundle

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore Byebug command history file.
.byebug_history

# Ignore environment file
.env

# Ignore locally compiled assets and local media
/public/assets/*
/public/media/*
/node_modules/

# Ignore Redis writes to disk
/dump.rdb

# Ignore Docker config
/docker-compose.yml
/Dockerfile

# Ignore local Webpack files
/public/packs
/public/packs-test
/node_modules

# Ignore master key for decrypting credentials and more.
/config/master.key

From a gem that I made via a plugin generator:

.bundle/
log/*.log
pkg/
test/dummy/db/*.sqlite3
test/dummy/db/*.sqlite3-journal
test/dummy/log/*.log
test/dummy/tmp/
camaleon_sitemap_customizer*.gem
 
# log
*.log

# Runtime data
.DS_Store
*.pid

# dependencies
node_modules

build

#test
coverage

yarn.lock

*.idea/
.vscode/
.agignore
 

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.

 

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/

 

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

 
 
Classic DEV Post from May 19

Solving Puzzles With High-Performance JavaScript

Maximilian Koch profile image