Last Updated: February 25, 2016
·
2.092K
· gpakosz

Git ignore all the crap, globally

Put the following file in ~/.gitignore (edit it depending on your exact needs)

# visual studio specific files
*.user
*.ncb
*.sbr
*.suo
*.ilk
*.bsc
*.pdb
*.aps
*.pch
*.sdf
*.opensdf
*.sln.docstates
ipch/

# xcode specific files
*.pbxuser
*.ext
*.mode1v3
*.perspectivev3
xcuserdata/

# autotools specific files
*.sym
Makefile.in
config.h.in
autom4te.cache/
build-aux/
configure

# build files
build/
obj
*.obj
*.o

# vi / vim files
*~
.*.swp

# OSX finder crap
.DS_Store

# temporary
temp
tmp
.tmp

# git
*.orig
*.rej

Now to setup your global .gitignore, just run

$ git config --global core.excludesfile ~/.gitignore

See the core.excludesfile section in git-config manual

2 Responses
Add your response

The IDE/text editor make sense on a per-computer basis. However, if you are doing any collaborative work, things like .DS_Store and *.orig should be placed into every project.

It is more effort across all persons to have a common set up like this than it is on a per-project basis especially if those people are strangers (e.g. GitHub).

over 1 year ago ·

Indeed, most collaborative projects will likely have their own .gitignore.

Having a global .gitignore helps certain cases but isn't a free pass for not having a proper per project .gitignore.

over 1 year ago ·