Some very bad practice is to insert everything you want to be ignore in your project's .gitignore file, like making a generic github file. You can find a lot of these bad practices on the web.
Why is it so bad? Because in a team, noone can be a 100% sure that a line in a gitignore file can be safely removed without impacting some other dev.
If any line in your project's .gitignore file would not concern a new developer coming on the project, then you can improve it!
If reading your gitignore file you cannot guess where that file is supposed to be located and whether it is a file or a folder.
These simple rule can make it easier to read and avoid name collision
*.pyc(any file anywhere with .pyc extension)
__pycache__/(any folder anywhere with that name)
There are (more than) 3 possible locations where to ignore a file/folder for git:
.gitignorein the project's folder
.git/info/excludein the project's folder
is located in
~/.gitignore and contains anything that is specific to you like your OS files, your editors files, etc.
.DS_Storeif you're on a MacBook
Thumbs.dbis you're on Windows
Globally anything that will be common to multiple projects in a different language should probably be here.
Here you should insert anything that is specific to the nature of your project, like
*.pyc for python 2,
__pycache__/ for python 3,
/node_modules/ for npm projects, …
for ignoring files and folders that are specific to your project and to your preferences or environment. In other words, this location is to common point between your home gitignore and your project's gitignore. It is less common to use this though.
Examples for python:
By vinyll on March 15, 2017