0

Most advice I seem to find on so and other places seems to suggest something along the lines of including parts of the .idea folder but not all. One such example is the official Jetbrains .gitignore file here.

However I most places/answers don't really seem to give arguments as to why some files should be included, but from the answers that do it seems to be because you want to share the project structure.

I'm just not sure what this 'project structure' refers to. Our company uses pipenv and setup.py to share and manage dependencies.

Furthermore, at the time of writing I'm the only person who uses PyCharm at my work place, all other developers currently use VSCode.

To me it feels like I should just ignore the whole .idea folder (something the github python gitignore template lists as the 'nuclear option' and 'not recommended'.

Is there really a good reason to still include some parts of the .idea folder or not?

Kroppeb
  • 129
  • 5
  • 1
    Does this answer your question? [What to gitignore from the .idea folder?](https://stackoverflow.com/questions/11968531/what-to-gitignore-from-the-idea-folder) – psalt Jun 09 '23 at 10:09
  • 1
    I'd like to add that I see no reason to not ignore the whole `.idea/` folder. – psalt Jun 09 '23 at 10:13
  • @psalt No, to me all answers seem to be referring to the same jetbrains article in the end which just says you 'need' to do it like that. This seems wrong to as I can just open up projects that haven't been made with PyCharm where those files don't exist. Additionally, The files PyCharms wants me to commit just list that a. we use pipenv, b. the files in the folder are the code, c. we use git. – Kroppeb Jun 09 '23 at 10:26
  • Could you please remove the "git" tag. This question is not related to a problem you have with git but is more general about which files you want to include in your versioning tool (which just so happens to be git) – Kim Jun 09 '23 at 11:04

1 Answers1

1

In general, you should include files in your project which are required to build, test, or lint the project, but you should not include other files which are specific to a developer or a set of developers, such as editor configuration files for specific editors. It is good to include generic configuration files that can be used for configuring editors globally (like an .editorconfig, if your project has one) or tidying code with a standard tool.

The reason for this is that in general, it's a good idea to let every person use the editor (or shell) of their choice. Anything that's required for all developers to perform basic functionality (like building) for the project is important, but we don't want to have dueling editor configurations or bloated diffs just because of the preferences of a few users. Editor and shell configuration is often best left to a particular user's dotfiles, which is often a personal repository.

In your case, it sounds like nothing in the .idea folder is specific to building, testing, or linting your project, and it's merely editor configuration, so in that case, you'd want to ignore it all. Typically, the best place to do that is in $XDG_CONFIG_HOME/git/ignore (which defaults to ~/.config/git/ignore) because that way you can ignore any files that are specific to your editor for all projects and you don't need to update every specific project you work on to ignore every developer's editor files. In addition, by ignoring it for your particular user, you avoid accidentally including it in a project by mistake.

bk2204
  • 64,793
  • 6
  • 84
  • 100