Git 设置全局忽略 .gitignore_global
¶
Quicklinks¶
- https://git-scm.com/docs/gitignore
- https://git-scm.com/docs/git-config
Git 设置全局忽略 .gitignore_global
¶
# 使用 `vim` 在家目录下新建名为 `.gitignore_global` 的文件
vim ~/.gitignore_global
#
git config --global core.excludesfile ~/.gitignore_global
# 查看 Git 当前配置情况
git config --list
.gitignore_global
的忽略匹配规则:
可以通过 gitignore.io 来为项目自动生成必要的 .gitignore 忽略匹配规则。
# Created by https://www.toptal.com/developers/gitignore/api/macos
# Edit at https://www.toptal.com/developers/gitignore?templates=macos
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
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
### macOS Patch ###
# iCloud generated files
*.icloud
# End of https://www.toptal.com/developers/gitignore/api/macos