Once you start with GIT, you probably never got back.
It is just a too good tool for keeping track of changes and syncing data between hosts.
So you probably ended up with a couple of repositories, fetched from Github or crated on your own.
And as the complexity of the repositories grow, once common pattern shows up: the
.gitignore-file. The friendly little helper that keeps annoying files out of side that are unavoidable for work, but you really don’t need them afterwards. Kind like the coffe at work.
I found myself several times adding at least the vim swap files to that file.
Now, there’s also the possibility of using a global
.gitignore file instead.
.gitignore-file can be anyfile you like. Just following the syntax as usual is mandatory.
$ cat ~/.gitignore_global *.txt *.swp
This file needs to be defined systemwide to be valid for all repositories on your computer:
$ git config --global core.excludesfile ~/.gitignore_global
The nice thing is, that this file works in addition to an existing
.gitignore within the repository. So you can always specify additional files locally, before adding them globally. The Gitignore-manual states this functionality already in the second paragraph:
When deciding whether to ignore a path, Git normally checks gitignore patterns from multiple sources, with the following order of precedence, from highest to lowest (within one level of precedence, the last matching pattern decides the outcome):
Patterns read from the command line for those commands that support them.
Patterns read from a .gitignore file in the same directory as the path, or in any parent directory, with patterns in the higher level files (up to the toplevel of the work tree) being overridden by those in lower level files down to the directory containing the file. These patterns match relative to the location of the .gitignore file. A project normally includes such .gitignore files in its repository, containing patterns for files generated as part of the project build.
Patterns read from $GIT_DIR/info/exclude.
Patterns read from the file specified by the configuration variable core.excludesFile
I should read more manuals.. obviously.
Oh: the Octocat has some templates already available (Read the comments as well!).