tags:

views:

156

answers:

4

I am a new user to git and I am starting a new project. I have a bunch of dot files that I would like to ignore. Is there an ignore command for git like there is for svn?

+2  A: 

Create a file named .gitignore on the root of your reposiroty. In this file you put the relative path to each file you wish to ignore in a single line. You can use the * wildcard.

Bruno Reis
+8  A: 

You have two ways of ignoring files:

  • .gitignore in any folder will ignore the files as specified in the file for that folder. Using wildcards is possible.
  • .git/info/exclude holds the global ignore pattern, similar to the global-ignores in subversions configuration file.
bluebrother
Note that patterns in `.gitignore` file which do not contain '/' are matched **recursively** (i.e. also in all subdirectories of the directory the `.gitignore` file is in), contrary to the case of `svn:ignore` directory properties in Subversion.
Jakub Narębski
+4  A: 

There is no special git ignore command. Edit a .gitignore file located in the appropriate place within the working copy.

Note that only file names starting with / will be relative to the directory .gitignore resides in. Everything else will match files in whatever subdirectory.

Run git help gitignore for the details.

ndim
"appropriate place" isn't very helpful.
bobDevil
Made the "appropriate place" more specific. Thanks for the hint.
ndim
+1 for git help gitignore
Dean
A: 

It's useful to define a complete .gitignore file for your project. The reward is safe use of the convenient --all or -a flag to commands like add and commit.

Also, consider defining a global ~/.gitignore file for commonly ignored patterns such as *~ , which covers temporary files created by Emacs.

seh