I would like to share a recent article about setting up a global .gitignore file, this article is written by Sebastian De Deyne Designer & developer at Spatie. I would recommend the full article. Although it does give some information on how to do this on Windows, I wanted to share an abbreviated version just for Windows users to easily follow.
TL&DR; windows version
When editing other projects, your IDE config should not pollute the other project.
That project's .gitignore should not care about your IDE.
First, create a .gitignore file. Your profile is a good place:
notepad %USERPROFILE%\.gitignore
To ignore PhpStorm, VSCode and any picture thumbs, add the following to the .gitignore:
.idea
.vscode
Thumbs.db
Save the file, then add it to your global git config:
git config --global core.excludesfile %USERPROFILE%\.gitignore
From now on when you open a project, with your IDE, your IDE config folder will be ignored by git version control. There is also a security benefit, your IDE could 'leak' information regarding your project config.