In general, you should not check in any files to the repository which are specific to your editor or IDE unless they are also absolutely required to build the project. So if you're using PyCharm for development, all of the files it generates should be ignored.
The reason is that on most projects with multiple developers, different people will use different editors. So while you use PyCharm, I might use Vim. We don't want our .gitignore
to have to learn about every user's preferred editor files, and we don't want to have to maintain multiple sets of editor files, especially since we may work on multiple projects together. If we need to configure settings, it's better to use an .editorconfig
file, which works across editors, or prefer a standardized set of tools, such as a code formatter (and check in any configuration we need for that).
Instead, you should configure core.excludesfile
(or use the default, $HOME/.config/git/ignore
) so that it excludes your editor files. This works for all repositories that you use so each project doesn't have to learn about those settings and lets you change one place if you change editors. So in this case, that means adding the /.idea
line to that file.