Let’s say that you work in the team where everyone uses different code editor/IDE. One person uses PyCharm and he doesn’t want to commit .idea
directory which keeps PyCharm files for current project. He adds .idea
to project .gitignore
file. Next person uses Sublime, so he adds *.sublime-project
and *.sublime-workspace
to the .gitignore
file. Every team member can add own things to .gitignore
. After some time it can look like this:
### IDE/Editor configs.idea# Eclipse.project.pydevproject.settings/# Vim.ropeproject# Sublime*.sublime-project*.sublime-workspace
# local virtualenv.venv
Is it a good solution? I don’t think so. The .gitignore
file should keep things only related to project, our IDE configuration files are not.
Solution?
You can create own global .gitignore
. Create ~/.gitignore_global
file and add your IDE/code editor/other stuff which should be ignored. Next, inform git that it should take this file into account.
git config --global core.excludesfile ~/.gitignore_global
Now, whatever you put in the ~/.gitignore_global
file, it will be used for every git project. You can clean up project .gitignore
file ;-)