This is a very short post to let you know that you can ignore files in Git globally, which is very useful for certain pesky files… I’m looking at you, .DS_Store …
While you probably know of the .gitignore in every directory individually, you can actually store a ‘global’ gitignore here:
~/.config/git/ignore
And there’s nothing you gotta do, as Git checks this file automatically. So, just happily write .DS_Store in there and be less annoyed!
Here’s an example to no longer fight your OS which I took the liberty to compile for you based on what I could find online:
# General
.DS_Store
__MACOSX/
.AppleDouble
.LSOverride
Icon[]
*~
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# Metadata left by Dolphin file manager, which comes with KDE Plasma
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
# Log files created by default by the nohup command
nohup.out
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
I hope this helps! <3
Leave A Comment