Merge branch 'jc/diff--cached'
[git] / Documentation / git-add.txt
1 git-add(1)
2 ==========
3
4 NAME
5 ----
6 git-add - Add file contents to the changeset to be committed next
7
8 SYNOPSIS
9 --------
10 'git-add' [-n] [-v] [--] <file>...
11
12 DESCRIPTION
13 -----------
14 All the changed file contents to be committed together in a single set
15 of changes must be "added" with the 'add' command before using the
16 'commit' command.  This is not only for adding new files.  Even modified
17 files must be added to the set of changes about to be committed.
18
19 This command can be performed multiple times before a commit. The added
20 content corresponds to the state of specified file(s) at the time the
21 'add' command is used. This means the 'commit' command will not consider
22 subsequent changes to already added content if it is not added again before
23 the commit.
24
25 The 'git status' command can be used to obtain a summary of what is included
26 for the next commit.
27
28 This command only adds non-ignored files, to add ignored files use
29 "git update-index --add".
30
31 Please see gitlink:git-commit[1] for alternative ways to add content to a
32 commit.
33
34
35 OPTIONS
36 -------
37 <file>...::
38         Files to add content from.
39
40 -n::
41         Don't actually add the file(s), just show if they exist.
42
43 -v::
44         Be verbose.
45
46 \--::
47         This option can be used to separate command-line options from
48         the list of files, (useful when filenames might be mistaken
49         for command-line options).
50
51
52 EXAMPLES
53 --------
54 git-add Documentation/\\*.txt::
55
56         Adds content from all `\*.txt` files under `Documentation`
57         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         Considers adding content from all git-*.sh scripts.
66         Because this example lets shell expand the asterisk
67         (i.e. you are listing the files explicitly), it does not
68         consider `subdir/git-foo.sh`.
69
70 See Also
71 --------
72 gitlink:git-status[1]
73 gitlink:git-rm[1]
74 gitlink:git-mv[1]
75 gitlink:git-commit[1]
76 gitlink:git-update-index[1]
77
78 Author
79 ------
80 Written by Linus Torvalds <torvalds@osdl.org>
81
82 Documentation
83 --------------
84 Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
85
86 GIT
87 ---
88 Part of the gitlink:git[7] suite
89