]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-add.txt
cvsserver: avoid warning about active db handles
[thirdparty/git.git] / Documentation / git-add.txt
CommitLineData
215a7ad1
JH
1git-add(1)
2==========
7fc9d69f
JH
3
4NAME
5----
7bd7f280 6git-add - Add files to the index file
7fc9d69f
JH
7
8SYNOPSIS
9--------
60ace879 10'git-add' [-n] [-v] [--] <file>...
7fc9d69f
JH
11
12DESCRIPTION
13-----------
810bf1f9
JH
14A simple wrapper for git-update-index to add files to the index,
15for people used to do "cvs add".
16
845ae27b
SB
17It only adds non-ignored files, to add ignored files use
18"git update-index --add".
7fc9d69f
JH
19
20OPTIONS
21-------
905197de 22<file>...::
845ae27b 23 Files to add to the index (see gitlink:git-ls-files[1]).
7fc9d69f 24
918db541
CS
25-n::
26 Don't actually add the file(s), just show if they exist.
27
28-v::
29 Be verbose.
30
e994004f 31\--::
60ace879
CW
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
918db541 36
810bf1f9
JH
37DISCUSSION
38----------
39
40The list of <file> given to the command is fed to `git-ls-files`
89438677 41command to list files that are not registered in the index and
810bf1f9
JH
42are 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
52EXAMPLES
53--------
54git-add Documentation/\\*.txt::
55
56 Adds all `\*.txt` files that are not in the index under
57 `Documentation` directory and its subdirectories.
58+
59Note that the asterisk `\*` is quoted from the shell in this
60example; this lets the command to include the files from
61subdirectories of `Documentation/` directory.
62
63git-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
872d001f
JM
70See Also
71--------
72gitlink:git-rm[1]
845ae27b 73gitlink:git-ls-files[1]
810bf1f9 74
7fc9d69f
JH
75Author
76------
77Written by Linus Torvalds <torvalds@osdl.org>
78
79Documentation
80--------------
81Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
82
83GIT
84---
a7154e91 85Part of the gitlink:git[7] suite
7fc9d69f 86