4

O., I am wondering if there is a way to globally ignore the .idea folder on my machine? I don't have or need a .gitignore file in my project, but it is irritating that the .idea/ folder keeps appearing when trying to add and commit real changes.

Any idea?

CodeConnoisseur
  • 1,452
  • 4
  • 21
  • 49

3 Answers3

16
  • Configure the path to the global .gitignore in the .gitconfig file which usually resides in your home directory:
# add this to ~/.gitconfig:
[core]
    excludesfile = ~/.gitignore
  • And create the .gitignore file in your home directory:
# create ~/.gitignore

.idea

.idea will be ignored in any git repository on your machine.

2

This is straight from git help ignore:

Patterns which a user wants Git to ignore in all situations (e.g., backup or temporary files generated by the user’s editor of choice) generally go into a file specified by core.excludesFile in the user’s ~/.gitconfig. Its default value is $XDG_CONFIG_HOME/git/ignore. If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/ignore is used instead.

eftshift0
  • 26,375
  • 3
  • 36
  • 60
1

There is an answer here already: See CB Baileys answer.

It involves setting a gitignore file 'somewhere'. Specify where, by using the command given by on that link.

Then you need to actually create the file at ~/.gitignore, adding .vscode or in your case, .idea there.

Ben Butterworth
  • 22,056
  • 10
  • 114
  • 167