I have been a Windows user for all my life until a year ago when I switched to Mac. I don’t regret that decision so far.
This article, however, is not a Mac glaze or an OS debate.
It's about how I accidentally discovered a secret git feature that no one talks about.
Ever since I switched, I've noticed there's this file called “.DS_Store” that starts appearing in my coding projects.

It's a bit annoying, but it seems harmless, so I ignored it.
Then one day it caused an error when I ran a Git command.
That’s when I finally looked it up.
Turns out, Mac OS automatically generates it whenever you open a folder in Finder.
It means that I have to add that to almost every project's “.gitignore” manually.

That's annoying.
I wonder if there's a way to do a global gitignore?
And there is.
Apparently, you just have to
Create a file here (works for Linux too):
touch ~/.config/git/ignore(or "%USERPROFILE%\git\ignore" for Windows)
Write the files you want to ignore as you do in ".gitignore"
.DS_Store
.vscode
.kiroThen git will ignore these files across every Git repository on your machine.
You can use this to omit files like:
OS files: .DS_Store, Thumbs.db
Editor/IDE settings: .vscode/, .idea/, *.swp
It's a nice little feature that lets you keep all the annoying files away from your git history forever.
- Fee from Anime Coders

