How do we keep a readable and manageable .gitignore in a team of many members? The following solution takes advantage of the 3 different files where ignored paths may be stored:
Use the project’s .gitignore for:
Vendor modules, logs, upload folders and environment configuration files. They should be ignored because they are either not relevant, or otherwise automatically managed and updated on other repository clones.
Use your global .gitignore for:
OS or IDE-specific indexing and description files. Your co-workers with a Windows system shouldn’t be concerned with your Mac-related settings (.DS_Store
), just as users of Atom shouldn’t care about the .idea
folder automatically created by IntelliJ. Adding these to the .gitignore will only crowd the file unnecessarily.
Your global ignore settings usually reside in ~/.gitconfig.
Use the repository exclude file for:
Custom files you use in your workflow but should not be shared to other repositories. E.g. project-specific like documentation-todos.txt
, language or framework-specific like*pyc
.
Need more help?
Read more and find help generating a .gitignore:
https://git-scm.com/docs/gitignore