Setting Up Global Git Ignore Rules

To setup a file with a list of items which should be ignored globally on your local system:

git config --global core.excludesfile ~/.gitignore_global

To view the currently set file:

git config --get core.excludesfile

My current file for use on macOS:

# General files
.DS_Store
.AppleDouble
.Apple Double
.LSOverride

# Thumbnail cache files
._*
Thumbs.db

# Custom icon file (which ends with \r), but not other icon* entries
Icon?
![iI]con[_a-zA-Z0-9]

# Files which can be in root of an external volume
.com.apple.timemachine.donotpresent
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Possible directories on a remote AFP share
.apdisk
.AppleDB
.AppleDesktop
.Apple Desktop
Network Trash Folder
Temporary Items

# Application specific files/directories
.idea/
.vscode
*.code-workspace

# Local WIP and Notes
/_*.md
/_ToDo
/_Old
/_Open
/_WIP

# Temporary test files
/t
/t.*
/t-*
/t[0-9]
/t[0-9].*