LoginSignup
2
3

More than 3 years have passed since last update.

Mac用.gitignoreテンプレート

Last updated at Posted at 2020-07-29

gitignore Mac用

.DS_Storeとか、環境依存の不要なファイルをgitに混入させない設定

内容としては、github/gitignore: A collection of useful .gitignore templatesの紹介です。

ディレクトリとファイル作って、vimで編集

まずはグローバルの設定を変更します。

mkdir -p ~/.config/git && vim $_/ignore

ignoreの中身 (コピペでOK)

参考: gitignore/macOS.gitignore at master · github/gitignore

~/.config/git/ignore
# 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

Mac以外の人は以下の一覧から探して入れる。
参考: gitignore/Global at master · github/gitignore

言語ごとにローカルの.gitginoreを設定する

自分の場合はCなのでCのディレクトリの.gitignoreは以下の設定を入れる。

参考: gitignore/C.gitignore at master · github/gitignore

# Prerequisites
*.d

# Object files
*.o
*.ko
*.obj
*.elf

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

他にもいろんな言語が網羅されています。
参考: github/gitignore: A collection of useful .gitignore templates

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3