GIT 1.4.4.3
[git/git.git] / Documentation / git-add.txt
1 git-add(1)
2 ==========
3
4 NAME
5 ----
6 git-add - Add files to the index file
7
8 SYNOPSIS
9 --------
10 'git-add' [-n] [-v] [--] <file>...
11
12 DESCRIPTION
13 -----------
14 A simple wrapper for git-update-index to add files to the index,
15 for people used to do "cvs add".
16
17 It only adds non-ignored files, to add ignored files use
18 "git update-index --add".
19
20 OPTIONS
21 -------
22 <file>...::
23 Files to add to the index (see gitlink:git-ls-files[1]).
24
25 -n::
26 Don't actually add the file(s), just show if they exist.
27
28 -v::
29 Be verbose.
30
31 \--::
32 This option can be used to separate command-line options from
33 the list of files, (useful when filenames might be mistaken
34 for command-line options).
35
36
37 DISCUSSION
38 ----------
39
40 The list of <file> given to the command is fed to `git-ls-files`
41 command to list files that are not registered in the index and
42 are not ignored/excluded by `$GIT_DIR/info/exclude` file or
43 `.gitignore` file in each directory. This means two things:
44
45 . You can put the name of a directory on the command line, and
46 the command will add all files in it and its subdirectories;
47
48 . Giving the name of a file that is already in index does not
49 run `git-update-index` on that path.
50
51
52 EXAMPLES
53 --------
54 git-add Documentation/\\*.txt::
55
56 Adds all `\*.txt` files that are not in the index under
57 `Documentation` directory and its subdirectories.
58 +
59 Note that the asterisk `\*` is quoted from the shell in this
60 example; this lets the command to include the files from
61 subdirectories of `Documentation/` directory.
62
63 git-add git-*.sh::
64
65 Adds all git-*.sh scripts that are not in the index.
66 Because this example lets shell expand the asterisk
67 (i.e. you are listing the files explicitly), it does not
68 add `subdir/git-foo.sh` to the index.
69
70 See Also
71 --------
72 gitlink:git-rm[1]
73 gitlink:git-ls-files[1]
74
75 Author
76 ------
77 Written by Linus Torvalds <torvalds@osdl.org>
78
79 Documentation
80 --------------
81 Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
82
83 GIT
84 ---
85 Part of the gitlink:git[7] suite
86