What to do with custom configuration files (for example: .idea /)?

I have some configuration files ( .idea/ ) from the IDE in my working directory, and Git lists them as Untracked files . Should I

  • add them to .gitignore (which will be redirected to the main repo) or
  • use local option

     git update-index --assume-unchanged <name of file> 
  • or generally take a different approach?

What is the best practice?

+2
source share
3 answers

These files are for your own machine / setup. You really have to ignore them.

However, you should not just add entries corresponding to these files in your .gitignore project. Instead, you should ignore these files with global .gitignore :

 git config --global core.excludesfile <path-to-global-ignore-file> 

Why not just add entries to your .gitignore project? Remember that this file will be used by all project staff, so you want to keep it clean and tidy; adding custom entries to a specific .gitignore repository will simply inflate / pollute the latter and contribute to unnecessary mental overhead.

For example, imagine one employee, Bob, works on Mac OS X, while another employee, Alice, works on Windows. Bob probably wants to ignore .DS_Store files , while Alice probably wants to ignore thumbs.db . However, Bob does not need to ignore the thumbs.db files, and Alice does not need to ignore the .DS_Store files. Therefore, they should not put a useless gitignore record on top of each other. They would be better off ignoring such files through the local .gitignore file for their machines.

+4
source

The .idea folder and related .iws , .ipr and .iwl really intended for your machine only. It is best to add them to .gitignore .

+1
source

Special IDE files should always be ignored. If it is possible that everyone in your team is working with the same IDE, then it might be useful to keep some. But in most cases this is not so.

If you decide to β€œdelete” them locally, there is always a risk that someone will forget to do this, so it’s best to just put it in gitignore.

Here is a list of specific gitignore files for the IDE that you can use https://github.com/github/gitignore/tree/master/Global

+1
source

Source: https://habr.com/ru/post/985367/


All Articles