Global Git Ignores Make Collaborative Development Easier

Lots of developers are using git, especially when working on projects together.  However there is not one single developer tool that every one uses, so there is potential for a lot of unwanted files to end up in your project.

Rather than pollute the .gitignore file for the project with every development tool under the sun, its much more effective to add development tool specific files to your own global ignore file ~/.gitignore_global.

Creating my own global ignores

In the ~/.gitconfig of my home directory I have a section called [core] where a global excludes file is defined

[core]
  excludesfile = /Users/jstevenson/.gitignore_global</span>

By adding file name patters to the .gitignore_global file for Emacs, I can add my own personal excludes without adding unnecessary stuff to each project I work on. It also means its one less thing to remember when I am working with git projects.

In the root of your home directory, simple create or update the file .gitignore_global with all the file names and patterns that relate to the tools you use.

Ignore patterns

To help you out, here are some ignore patterns for some of the most common developer tools.  There are lots of ignore patterns on the Git Ignore github repository

Emacs ignore patterns

I use Emacs for much of my development projects, so here are some ignore patters I add to my .gitignore_global file

1
2
3
4
5
6
7
8
9
*~
\#*
\#
/.emacs.desktop
/.emacs.desktop.lock
.elc
auto-save-list
tramp
.\#*

Org-mode

I also create a lot of developer content using Emacs Org-mode, so here are the ignore patterns I add for this.

1
2
.org-id-locations
*_archive

Vi / Vim

.*.s[a-w][a-z]

IntelliJ ignore patterns

1
2
3
4
*.iml
*.ipr
*.iws
.idea/

Netbeans ignore patters

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml


## Eclipse ignore patters

{% img img-thumbnail http://1.bp.blogspot.com/-RmrjIrvG7dE/URUVuk2P5QI/AAAAAAAAJCQ/RGcprIpBxjc/s1600/Eclipse_Icon_by_flosweb.png %}

``` .gitignore_global
*.pydevproject
.project
.metadata
bin/**
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
.externalToolBuilders/
*.launch
.cproject
.buildp

Thank you.
@jr0cket


This work is licensed under a Creative Commons Attribution 4.0 ShareAlike License, including custom images & stylesheets. Permissions beyond the scope of this license may be available at @jr0cket
Creative Commons License