---
title: Global .gitignore
teaser:
tags: git,vim
author: Dan Croak
published_on: 2012-03-04
---

Set a `.gitignore` file to apply across all projects on your local machine
with:

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

The only ignored pattern I have right now is:

    *.swp

That ignores temporary files created by vim.

I used to ignore those files in each project I worked on but then I recognized
my presumptuousness: not every teammate on every project is also using vim.

For them, that line is unnecessary.

We might say, "Who cares? It's only one line." but I appreciate it when my
teammates are similarly disciplined so I ought to apply The Golden Rule.

> "Programming at its best is an act of empathy." - [Kent
> Beck](http://rubyrogues.com/023-rr-book-club-smalltalk-best-practice-patterns-with-kent-beck/)

What else do you have in your global `~/.gitignore`?
