Git Ignore
Create the file ~/.gitignore
as shown below to not track files that are almost always ignored in all Git repositories.
touch ~/.gitignore
Open the .gitignore
file using your favourite text editor and add these below:
# Folder view configuration files
.DS_Store
Desktop.ini
.LSOverride
# Icon must end with two \r
Icon
# Thumbnail cache files
._*
Thumbs.db
# Files that might appear on external disks
.Spotlight-V100
.Trashes
# 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
# Compiled Python files
*.pyc
# Compiled C++ files
*.out
# Application specific files
venv
node_modules
.vscode
.sass-cache
Or simply download macOS specific .gitignore maintained by GitHub itself and put contents of it to~/.gitignore
.
Note: You can also download it using curl
curl https://raw.githubusercontent.com/github/gitignore/master/Global/macOS.gitignore -o ~/.gitignore
If your gitignore file isn't working, you probably need to set up your global core.excludesfile
configuration file to point to this global ignore file.
git config --global core.excludesfile '~/.gitignore'
Last updated
Was this helpful?