t2m_oa
Last Updated: February 25, 2016
·
638
· hauleth

Ignore files in all repos

Sometimes we have files that we want to exclude from our app in general. Like compiled files, backups, ctags files logs or tarballs. In all of them we want to get rid of it from tree but adding them to the .gitignore every time we create new repo is a little bit irritating.

So what can we do? For example add global gitignore:

Create file like this in ~/.gitdata/gitignore (gist):

# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db

# Sublime Text files #
######################
*.sublime-*

# CTags files #
###############
.tags
.tags_sorted_by_file

# Backup files #
################
*~

And then add it as global excludes file:

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