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
A very useful git ignore command comes with the awesome tj/git-extras.
Here are a few usage examples:
git ignore
git ignore "*.log"
git ignore-io -a rails
git-extras provides many more useful commands. Definitely worth trying out.
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.Create a file named .gitignore on the root of your repository. 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 to install git-extras for this. You can install it in Ubuntu using apt-get,
$ sudo apt-get install git-extras
Then you can use the git ignore command.
$ git ignore file_name
On Linux/Unix, you can append files to the .gitignore file with the echo
command. For example if you want to ignore all .svn
folders, run this from the root of the project:
echo .svn/ >> .gitignore