@@ -14,28 +14,32 @@ SYNOPSIS
14
14
15
15
DESCRIPTION
16
16
-----------
17
- This command adds the current content of new or modified files to the
18
- index, thus staging that content for inclusion in the next commit.
17
+ This command updates the index using the current content found in
18
+ the working tree, to prepare the content staged for the next commit.
19
+ It typically adds the current content of existing paths as a whole,
20
+ but with some options it can also be used to add content with
21
+ only part of the changes made to the working tree files applied, or
22
+ remove paths that do not exist in the working tree anymore.
19
23
20
24
The "index" holds a snapshot of the content of the working tree, and it
21
25
is this snapshot that is taken as the contents of the next commit. Thus
22
26
after making any changes to the working directory, and before running
23
- the commit command, you must use the ' add' command to add any new or
27
+ the commit command, you must use the ` add` command to add any new or
24
28
modified files to the index.
25
29
26
30
This command can be performed multiple times before a commit. It only
27
31
adds the content of the specified file(s) at the time the add command is
28
32
run; if you want subsequent changes included in the next commit, then
29
- you must run ' git add' again to add the new content to the index.
33
+ you must run ` git add` again to add the new content to the index.
30
34
31
- The ' git status' command can be used to obtain a summary of which
35
+ The ` git status` command can be used to obtain a summary of which
32
36
files have changes that are staged for the next commit.
33
37
34
- The ' git add' command will not add ignored files by default. If any
35
- ignored files were explicitly specified on the command line, ' git add'
38
+ The ` git add` command will not add ignored files by default. If any
39
+ ignored files were explicitly specified on the command line, ` git add`
36
40
will fail with a list of ignored files. Ignored files reached by
37
41
directory recursion or filename globbing performed by Git (quote your
38
- globs before the shell) will be silently ignored. The ' add' command can
42
+ globs before the shell) will be silently ignored. The ` add` command can
39
43
be used to add ignored files with the `-f` (force) option.
40
44
41
45
Please see linkgit:git-commit[1] for alternative ways to add content to a
@@ -92,28 +96,31 @@ apply.
92
96
93
97
-u::
94
98
--update::
95
- Update only files that git already knows about, staging modified
96
- content for commit and marking deleted files for removal. This
97
- is similar
98
- to what "git commit -a" does in preparation for making a commit,
99
- except that the update is limited to paths specified on the
100
- command line. If no paths are specified, all tracked files in the
101
- current directory and its subdirectories are updated.
99
+ Only match <filepattern> against already tracked files in
100
+ the index rather than the working tree. That means that it
101
+ will never stage new files, but that it will stage modified
102
+ new contents of tracked files and that it will remove files
103
+ from the index if the corresponding files in the working tree
104
+ have been removed.
105
+ +
106
+ If no <filepattern> is given, default to "."; in other words,
107
+ update all tracked files in the current directory and its
108
+ subdirectories.
102
109
103
110
-A::
104
111
--all::
105
- Update files that git already knows about (same as '\--update')
106
- and add all untracked files that are not ignored by '.gitignore'
107
- mechanism.
108
-
112
+ Like `-u`, but match <filepattern> against files in the
113
+ working tree in addition to the index. That means that it
114
+ will find new files as well as staging modified content and
115
+ removing files that are no longer in the working tree.
109
116
110
117
-N::
111
118
--intent-to-add::
112
119
Record only the fact that the path will be added later. An entry
113
120
for the path is placed in the index with no content. This is
114
121
useful for, among other things, showing the unstaged content of
115
- such files with ' git diff' and committing them with ' git commit
116
- -a' .
122
+ such files with ` git diff` and committing them with ` git commit
123
+ -a` .
117
124
118
125
--refresh::
119
126
Don't add the file(s), but only refresh their stat()
@@ -133,7 +140,7 @@ apply.
133
140
Configuration
134
141
-------------
135
142
136
- The optional configuration variable ' core.excludesfile' indicates a path to a
143
+ The optional configuration variable ` core.excludesfile` indicates a path to a
137
144
file containing patterns of file names to exclude from git-add, similar to
138
145
$GIT_DIR/info/exclude. Patterns in the exclude file are used in addition to
139
146
those in info/exclude. See linkgit:gitrepository-layout[5].
@@ -181,17 +188,17 @@ and type return, like this:
181
188
What now> 1
182
189
------------
183
190
184
- You also could say "s" or " sta" or " status" above as long as the
191
+ You also could say `s` or ` sta` or ` status` above as long as the
185
192
choice is unique.
186
193
187
194
The main command loop has 6 subcommands (plus help and quit).
188
195
189
196
status::
190
197
191
198
This shows the change between HEAD and index (i.e. what will be
192
- committed if you say " git commit" ), and between index and
199
+ committed if you say ` git commit` ), and between index and
193
200
working tree files (i.e. what you could stage further before
194
- " git commit" using " git- add" ) for each path. A sample output
201
+ ` git commit` using ` git add` ) for each path. A sample output
195
202
looks like this:
196
203
+
197
204
------------
0 commit comments