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?
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.
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 theglobal-ignores
in subversions configuration file.
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.
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.