Wednesday, November 26, 2014

For All Git Repos, Ignore All of This

Summary

Are there files that you are always having to add to the .gitignore file for all of your git repositories?

If so, use this technique to create a global ignore file that is automatically applied to all of your git repos on you local workstation.

For all git repos, ignore all of this

First, create the file to contain the global git ignore patterns:

~/.gitignore_global


# 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
.idea
.metadata

/lex_ignore

Then, configure git to use the gitignore_global ignore patterns.

git config --global core.excludesfile ~/.gitignore_global


Share this article



This work is licensed under the Creative Commons Attribution 3.0 Unported License.

1 comment: