Information Technology Reference
In-Depth Information
$ cd git-recipes
$ mkdir 13-08
$ cd 13-08
$ git init
Create an empty initial revision with:
$ git commit --allow-empty -m "Initial commit"
Create the file named
.gitignore
with the following contents:
/tmp/
*.abc
You can do this with the following two commands:
echo /tmp/ > .gitignore
echo "*.abc" >> .gitignore
Commit the file
.gitignore
into the repository with:
$ git add -A
$ git commit -m "Gitignore: new rules to ignore files"
The repository is ready; you can share it with other developers.
To test whether the files stored within the
/tmp/
directory and the files with the
.abc
extension are really ignored create two files:
$ echo abc > some-file.abc
$ mkdir tmp
$ echo def > tmp/some-file.txt
and check the status of the repository with the
$ git status
command. The
files that match the patterns defined in
.gitignore
file are not reported by
$ git
status
.
How It Works