No need to set variable to NULL
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / git-add.xml
blobd1a445c5f8c6863fade4b7fa6b578c7a5f80fe9a
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE sect2 SYSTEM "../../../dtd/dblite.dtd">\r
3 \r
4 <sect2 lang="en" id="git-add(1)">\r
5     <title>git-add(1)</title>\r
6     <date>2024-07-02</date>\r
7 <revhistory><revision><date>2024-07-02</date></revision></revhistory>\r
8 <indexterm>\r
9 <primary>git-add(1)</primary>\r
10 </indexterm>\r
11 <simplesect id="git-add(1)__name">\r
12 <title>NAME</title>\r
13 <simpara>git-add - Add file contents to the index</simpara>\r
14 </simplesect>\r
15 <simplesect id="git-add(1)__synopsis">\r
16 <title>SYNOPSIS</title>\r
17 <blockquote>\r
18 <literallayout><emphasis>git add</emphasis> [--verbose | -v] [--dry-run | -n] [--force | -f] [--interactive | -i] [--patch | -p]\r
19           [--edit | -e] [--[no-]all | -A | --[no-]ignore-removal | [--update | -u]] [--sparse]\r
20           [--intent-to-add | -N] [--refresh] [--ignore-errors] [--ignore-missing] [--renormalize]\r
21           [--chmod=(+|-)x] [--pathspec-from-file=&lt;file&gt; [--pathspec-file-nul]]\r
22           [--] [&lt;pathspec&gt;&#8230;]</literallayout>\r
23 </blockquote>\r
24 </simplesect>\r
25 <simplesect id="git-add(1)__description">\r
26 <title>DESCRIPTION</title>\r
27 <simpara>This command updates the index using the current content found in\r
28 the working tree, to prepare the content staged for the next commit.\r
29 It typically adds the current content of existing paths as a whole,\r
30 but with some options it can also be used to add content with\r
31 only part of the changes made to the working tree files applied, or\r
32 remove paths that do not exist in the working tree anymore.</simpara>\r
33 <simpara>The "index" holds a snapshot of the content of the working tree, and it\r
34 is this snapshot that is taken as the contents of the next commit.  Thus\r
35 after making any changes to the working tree, and before running\r
36 the commit command, you must use the <emphasis>add</emphasis> command to add any new or\r
37 modified files to the index.</simpara>\r
38 <simpara>This command can be performed multiple times before a commit.  It only\r
39 adds the content of the specified file(s) at the time the add command is\r
40 run; if you want subsequent changes included in the next commit, then\r
41 you must run <emphasis>git add</emphasis> again to add the new content to the index.</simpara>\r
42 <simpara>The <emphasis>git status</emphasis> command can be used to obtain a summary of which\r
43 files have changes that are staged for the next commit.</simpara>\r
44 <simpara>The <emphasis>git add</emphasis> command will not add ignored files by default.  If any\r
45 ignored files were explicitly specified on the command line, <emphasis>git add</emphasis>\r
46 will fail with a list of ignored files.  Ignored files reached by\r
47 directory recursion or filename globbing performed by Git (quote your\r
48 globs before the shell) will be silently ignored.  The <emphasis>git add</emphasis> command can\r
49 be used to add ignored files with the <emphasis>-f</emphasis> (force) option.</simpara>\r
50 <simpara>Please see <xref linkend="git-commit(1)" /> for alternative ways to add content to a\r
51 commit.</simpara>\r
52 </simplesect>\r
53 <simplesect id="git-add(1)__options">\r
54 <title>OPTIONS</title>\r
55 <variablelist>\r
56 <varlistentry>\r
57 <term>\r
58 &lt;pathspec&gt;&#8230;\r
59 </term>\r
60 <listitem>\r
61 <simpara>\r
62         Files to add content from.  Fileglobs (e.g. <emphasis>*.c</emphasis>) can\r
63         be given to add all matching files.  Also a\r
64         leading directory name (e.g. <emphasis>dir</emphasis> to add <emphasis>dir/file1</emphasis>\r
65         and <emphasis>dir/file2</emphasis>) can be given to update the index to\r
66         match the current state of the directory as a whole (e.g.\r
67         specifying <emphasis>dir</emphasis> will record not just a file <emphasis>dir/file1</emphasis>\r
68         modified in the working tree, a file <emphasis>dir/file2</emphasis> added to\r
69         the working tree, but also a file <emphasis>dir/file3</emphasis> removed from\r
70         the working tree). Note that older versions of Git used\r
71         to ignore removed files; use <emphasis>--no-all</emphasis> option if you want\r
72         to add modified or new files but ignore removed ones.\r
73 </simpara>\r
74 <simpara>For more details about the <emphasis>&lt;pathspec&gt;</emphasis> syntax, see the <emphasis>pathspec</emphasis> entry\r
75 in <xref linkend="gitglossary(7)" />.</simpara>\r
76 </listitem>\r
77 </varlistentry>\r
78 <varlistentry>\r
79 <term>\r
80 -n\r
81 </term>\r
82 <term>\r
83 --dry-run\r
84 </term>\r
85 <listitem>\r
86 <simpara>\r
87         Don't actually add the file(s), just show if they exist and/or will\r
88         be ignored.\r
89 </simpara>\r
90 </listitem>\r
91 </varlistentry>\r
92 <varlistentry>\r
93 <term>\r
94 -v\r
95 </term>\r
96 <term>\r
97 --verbose\r
98 </term>\r
99 <listitem>\r
100 <simpara>\r
101         Be verbose.\r
102 </simpara>\r
103 </listitem>\r
104 </varlistentry>\r
105 <varlistentry>\r
106 <term>\r
107 -f\r
108 </term>\r
109 <term>\r
110 --force\r
111 </term>\r
112 <listitem>\r
113 <simpara>\r
114         Allow adding otherwise ignored files.\r
115 </simpara>\r
116 </listitem>\r
117 </varlistentry>\r
118 <varlistentry>\r
119 <term>\r
120 --sparse\r
121 </term>\r
122 <listitem>\r
123 <simpara>\r
124         Allow updating index entries outside of the sparse-checkout cone.\r
125         Normally, <emphasis>git add</emphasis> refuses to update index entries whose paths do\r
126         not fit within the sparse-checkout cone, since those files might\r
127         be removed from the working tree without warning. See\r
128         <xref linkend="git-sparse-checkout(1)" /> for more details.\r
129 </simpara>\r
130 </listitem>\r
131 </varlistentry>\r
132 <varlistentry>\r
133 <term>\r
134 -i\r
135 </term>\r
136 <term>\r
137 --interactive\r
138 </term>\r
139 <listitem>\r
140 <simpara>\r
141         Add modified contents in the working tree interactively to\r
142         the index. Optional path arguments may be supplied to limit\r
143         operation to a subset of the working tree. See Interactive\r
144         mode for details.\r
145 </simpara>\r
146 </listitem>\r
147 </varlistentry>\r
148 <varlistentry>\r
149 <term>\r
150 -p\r
151 </term>\r
152 <term>\r
153 --patch\r
154 </term>\r
155 <listitem>\r
156 <simpara>\r
157         Interactively choose hunks of patch between the index and the\r
158         work tree and add them to the index. This gives the user a chance\r
159         to review the difference before adding modified contents to the\r
160         index.\r
161 </simpara>\r
162 <simpara>This effectively runs <emphasis>add --interactive</emphasis>, but bypasses the\r
163 initial command menu and directly jumps to the <emphasis>patch</emphasis> subcommand.\r
164 See Interactive mode for details.</simpara>\r
165 </listitem>\r
166 </varlistentry>\r
167 <varlistentry>\r
168 <term>\r
169 -e\r
170 </term>\r
171 <term>\r
172 --edit\r
173 </term>\r
174 <listitem>\r
175 <simpara>\r
176         Open the diff vs. the index in an editor and let the user\r
177         edit it.  After the editor was closed, adjust the hunk headers\r
178         and apply the patch to the index.\r
179 </simpara>\r
180 <simpara>The intent of this option is to pick and choose lines of the patch to\r
181 apply, or even to modify the contents of lines to be staged. This can be\r
182 quicker and more flexible than using the interactive hunk selector.\r
183 However, it is easy to confuse oneself and create a patch that does not\r
184 apply to the index. See EDITING PATCHES below.</simpara>\r
185 </listitem>\r
186 </varlistentry>\r
187 <varlistentry>\r
188 <term>\r
189 -u\r
190 </term>\r
191 <term>\r
192 --update\r
193 </term>\r
194 <listitem>\r
195 <simpara>\r
196         Update the index just where it already has an entry matching\r
197         <emphasis>&lt;pathspec&gt;</emphasis>.  This removes as well as modifies index entries to\r
198         match the working tree, but adds no new files.\r
199 </simpara>\r
200 <simpara>If no <emphasis>&lt;pathspec&gt;</emphasis> is given when <emphasis>-u</emphasis> option is used, all\r
201 tracked files in the entire working tree are updated (old versions\r
202 of Git used to limit the update to the current directory and its\r
203 subdirectories).</simpara>\r
204 </listitem>\r
205 </varlistentry>\r
206 <varlistentry>\r
207 <term>\r
208 -A\r
209 </term>\r
210 <term>\r
211 --all\r
212 </term>\r
213 <term>\r
214 --no-ignore-removal\r
215 </term>\r
216 <listitem>\r
217 <simpara>\r
218         Update the index not only where the working tree has a file\r
219         matching <emphasis>&lt;pathspec&gt;</emphasis> but also where the index already has an\r
220         entry. This adds, modifies, and removes index entries to\r
221         match the working tree.\r
222 </simpara>\r
223 <simpara>If no <emphasis>&lt;pathspec&gt;</emphasis> is given when <emphasis>-A</emphasis> option is used, all\r
224 files in the entire working tree are updated (old versions\r
225 of Git used to limit the update to the current directory and its\r
226 subdirectories).</simpara>\r
227 </listitem>\r
228 </varlistentry>\r
229 <varlistentry>\r
230 <term>\r
231 --no-all\r
232 </term>\r
233 <term>\r
234 --ignore-removal\r
235 </term>\r
236 <listitem>\r
237 <simpara>\r
238         Update the index by adding new files that are unknown to the\r
239         index and files modified in the working tree, but ignore\r
240         files that have been removed from the working tree.  This\r
241         option is a no-op when no <emphasis>&lt;pathspec&gt;</emphasis> is used.\r
242 </simpara>\r
243 <simpara>This option is primarily to help users who are used to older\r
244 versions of Git, whose "git add <emphasis>&lt;pathspec&gt;</emphasis>&#8230;" was a synonym\r
245 for "git add --no-all <emphasis>&lt;pathspec&gt;</emphasis>&#8230;", i.e. ignored removed files.</simpara>\r
246 </listitem>\r
247 </varlistentry>\r
248 <varlistentry>\r
249 <term>\r
250 -N\r
251 </term>\r
252 <term>\r
253 --intent-to-add\r
254 </term>\r
255 <listitem>\r
256 <simpara>\r
257         Record only the fact that the path will be added later. An entry\r
258         for the path is placed in the index with no content. This is\r
259         useful for, among other things, showing the unstaged content of\r
260         such files with <emphasis>git diff</emphasis> and committing them with <emphasis>git commit\r
261         -a</emphasis>.\r
262 </simpara>\r
263 </listitem>\r
264 </varlistentry>\r
265 <varlistentry>\r
266 <term>\r
267 --refresh\r
268 </term>\r
269 <listitem>\r
270 <simpara>\r
271         Don't add the file(s), but only refresh their stat()\r
272         information in the index.\r
273 </simpara>\r
274 </listitem>\r
275 </varlistentry>\r
276 <varlistentry>\r
277 <term>\r
278 --ignore-errors\r
279 </term>\r
280 <listitem>\r
281 <simpara>\r
282         If some files could not be added because of errors indexing\r
283         them, do not abort the operation, but continue adding the\r
284         others. The command shall still exit with non-zero status.\r
285         The configuration variable <emphasis>add.ignoreErrors</emphasis> can be set to\r
286         true to make this the default behaviour.\r
287 </simpara>\r
288 </listitem>\r
289 </varlistentry>\r
290 <varlistentry>\r
291 <term>\r
292 --ignore-missing\r
293 </term>\r
294 <listitem>\r
295 <simpara>\r
296         This option can only be used together with --dry-run. By using\r
297         this option the user can check if any of the given files would\r
298         be ignored, no matter if they are already present in the work\r
299         tree or not.\r
300 </simpara>\r
301 </listitem>\r
302 </varlistentry>\r
303 <varlistentry>\r
304 <term>\r
305 --no-warn-embedded-repo\r
306 </term>\r
307 <listitem>\r
308 <simpara>\r
309         By default, <emphasis>git add</emphasis> will warn when adding an embedded\r
310         repository to the index without using <emphasis>git submodule add</emphasis> to\r
311         create an entry in <emphasis>.gitmodules</emphasis>. This option will suppress the\r
312         warning (e.g., if you are manually performing operations on\r
313         submodules).\r
314 </simpara>\r
315 </listitem>\r
316 </varlistentry>\r
317 <varlistentry>\r
318 <term>\r
319 --renormalize\r
320 </term>\r
321 <listitem>\r
322 <simpara>\r
323         Apply the "clean" process freshly to all tracked files to\r
324         forcibly add them again to the index.  This is useful after\r
325         changing <emphasis>core.autocrlf</emphasis> configuration or the <emphasis>text</emphasis> attribute\r
326         in order to correct files added with wrong CRLF/LF line endings.\r
327         This option implies <emphasis>-u</emphasis>. Lone CR characters are untouched, thus\r
328         while a CRLF cleans to LF, a CRCRLF sequence is only partially\r
329         cleaned to CRLF.\r
330 </simpara>\r
331 </listitem>\r
332 </varlistentry>\r
333 <varlistentry>\r
334 <term>\r
335 --chmod=(+|-)x\r
336 </term>\r
337 <listitem>\r
338 <simpara>\r
339         Override the executable bit of the added files.  The executable\r
340         bit is only changed in the index, the files on disk are left\r
341         unchanged.\r
342 </simpara>\r
343 </listitem>\r
344 </varlistentry>\r
345 <varlistentry>\r
346 <term>\r
347 --pathspec-from-file=&lt;file&gt;\r
348 </term>\r
349 <listitem>\r
350 <simpara>\r
351         Pathspec is passed in <emphasis>&lt;file&gt;</emphasis> instead of commandline args. If\r
352         <emphasis>&lt;file&gt;</emphasis> is exactly <emphasis>-</emphasis> then standard input is used. Pathspec\r
353         elements are separated by LF or CR/LF. Pathspec elements can be\r
354         quoted as explained for the configuration variable <emphasis>core.quotePath</emphasis>\r
355         (see <xref linkend="git-config(1)" />). See also <emphasis>--pathspec-file-nul</emphasis> and\r
356         global <emphasis>--literal-pathspecs</emphasis>.\r
357 </simpara>\r
358 </listitem>\r
359 </varlistentry>\r
360 <varlistentry>\r
361 <term>\r
362 --pathspec-file-nul\r
363 </term>\r
364 <listitem>\r
365 <simpara>\r
366         Only meaningful with <emphasis>--pathspec-from-file</emphasis>. Pathspec elements are\r
367         separated with NUL character and all other characters are taken\r
368         literally (including newlines and quotes).\r
369 </simpara>\r
370 </listitem>\r
371 </varlistentry>\r
372 <varlistentry>\r
373 <term>\r
374 --\r
375 </term>\r
376 <listitem>\r
377 <simpara>\r
378         This option can be used to separate command-line options from\r
379         the list of files, (useful when filenames might be mistaken\r
380         for command-line options).\r
381 </simpara>\r
382 </listitem>\r
383 </varlistentry>\r
384 </variablelist>\r
385 </simplesect>\r
386 <simplesect id="git-add(1)__examples">\r
387 <title>EXAMPLES</title>\r
388 <itemizedlist>\r
389 <listitem>\r
390 <simpara>\r
391 Adds content from all <emphasis>*.txt</emphasis> files under <emphasis>Documentation</emphasis> directory\r
392   and its subdirectories:\r
393 </simpara>\r
394 <screen>$ git add Documentation/\*.txt</screen>\r
395 <simpara>Note that the asterisk <emphasis>*</emphasis> is quoted from the shell in this\r
396 example; this lets the command include the files from\r
397 subdirectories of <emphasis>Documentation/</emphasis> directory.</simpara>\r
398 </listitem>\r
399 <listitem>\r
400 <simpara>\r
401 Considers adding content from all git-*.sh scripts:\r
402 </simpara>\r
403 <screen>$ git add git-*.sh</screen>\r
404 <simpara>Because this example lets the shell expand the asterisk (i.e. you are\r
405 listing the files explicitly), it does not consider\r
406 <emphasis>subdir/git-foo.sh</emphasis>.</simpara>\r
407 </listitem>\r
408 </itemizedlist>\r
409 </simplesect>\r
410 <simplesect id="git-add(1)__interactive_mode">\r
411 <title>INTERACTIVE MODE</title>\r
412 <simpara>When the command enters the interactive mode, it shows the\r
413 output of the <emphasis>status</emphasis> subcommand, and then goes into its\r
414 interactive command loop.</simpara>\r
415 <simpara>The command loop shows the list of subcommands available, and\r
416 gives a prompt "What now&gt; ".  In general, when the prompt ends\r
417 with a single <emphasis>&gt;</emphasis>, you can pick only one of the choices given\r
418 and type return, like this:</simpara>\r
419 <screen>    *** Commands ***\r
420       1: status       2: update       3: revert       4: add untracked\r
421       5: patch        6: diff         7: quit         8: help\r
422     What now&gt; 1</screen>\r
423 <simpara>You also could say <emphasis>s</emphasis> or <emphasis>sta</emphasis> or <emphasis>status</emphasis> above as long as the\r
424 choice is unique.</simpara>\r
425 <simpara>The main command loop has 6 subcommands (plus help and quit).</simpara>\r
426 <variablelist>\r
427 <varlistentry>\r
428 <term>\r
429 status\r
430 </term>\r
431 <listitem>\r
432 <simpara>\r
433    This shows the change between HEAD and index (i.e. what will be\r
434    committed if you say <emphasis>git commit</emphasis>), and between index and\r
435    working tree files (i.e. what you could stage further before\r
436    <emphasis>git commit</emphasis> using <emphasis>git add</emphasis>) for each path.  A sample output\r
437    looks like this:\r
438 </simpara>\r
439 <screen>              staged     unstaged path\r
440      1:       binary      nothing foo.png\r
441      2:     +403/-35        +1/-1 add-interactive.c</screen>\r
442 <simpara>It shows that foo.png has differences from HEAD (but that is\r
443 binary so line count cannot be shown) and there is no\r
444 difference between indexed copy and the working tree\r
445 version (if the working tree version were also different,\r
446 <emphasis>binary</emphasis> would have been shown in place of <emphasis>nothing</emphasis>).  The\r
447 other file, add-interactive.c, has 403 lines added\r
448 and 35 lines deleted if you commit what is in the index, but\r
449 working tree file has further modifications (one addition and\r
450 one deletion).</simpara>\r
451 </listitem>\r
452 </varlistentry>\r
453 <varlistentry>\r
454 <term>\r
455 update\r
456 </term>\r
457 <listitem>\r
458 <simpara>\r
459    This shows the status information and issues an "Update&gt;&gt;"\r
460    prompt.  When the prompt ends with double <emphasis>&gt;&gt;</emphasis>, you can\r
461    make more than one selection, concatenated with whitespace or\r
462    comma.  Also you can say ranges.  E.g. "2-5 7,9" to choose\r
463    2,3,4,5,7,9 from the list.  If the second number in a range is\r
464    omitted, all remaining patches are taken.  E.g. "7-" to choose\r
465    7,8,9 from the list.  You can say <emphasis>*</emphasis> to choose everything.\r
466 </simpara>\r
467 <simpara>What you chose are then highlighted with <emphasis>*</emphasis>,\r
468 like this:</simpara>\r
469 <screen>           staged     unstaged path\r
470   1:       binary      nothing foo.png\r
471 * 2:     +403/-35        +1/-1 add-interactive.c</screen>\r
472 <simpara>To remove selection, prefix the input with <emphasis>-</emphasis>\r
473 like this:</simpara>\r
474 <screen>Update&gt;&gt; -2</screen>\r
475 <simpara>After making the selection, answer with an empty line to stage the\r
476 contents of working tree files for selected paths in the index.</simpara>\r
477 </listitem>\r
478 </varlistentry>\r
479 <varlistentry>\r
480 <term>\r
481 revert\r
482 </term>\r
483 <listitem>\r
484 <simpara>\r
485   This has a very similar UI to <emphasis>update</emphasis>, and the staged\r
486   information for selected paths are reverted to that of the\r
487   HEAD version.  Reverting new paths makes them untracked.\r
488 </simpara>\r
489 </listitem>\r
490 </varlistentry>\r
491 <varlistentry>\r
492 <term>\r
493 add untracked\r
494 </term>\r
495 <listitem>\r
496 <simpara>\r
497   This has a very similar UI to <emphasis>update</emphasis> and\r
498   <emphasis>revert</emphasis>, and lets you add untracked paths to the index.\r
499 </simpara>\r
500 </listitem>\r
501 </varlistentry>\r
502 <varlistentry>\r
503 <term>\r
504 patch\r
505 </term>\r
506 <listitem>\r
507 <simpara>\r
508   This lets you choose one path out of a <emphasis>status</emphasis> like selection.\r
509   After choosing the path, it presents the diff between the index\r
510   and the working tree file and asks you if you want to stage\r
511   the change of each hunk.  You can select one of the following\r
512   options and type return:\r
513 </simpara>\r
514 <literallayout class="monospaced">y - stage this hunk\r
515 n - do not stage this hunk\r
516 q - quit; do not stage this hunk or any of the remaining ones\r
517 a - stage this hunk and all later hunks in the file\r
518 d - do not stage this hunk or any of the later hunks in the file\r
519 g - select a hunk to go to\r
520 / - search for a hunk matching the given regex\r
521 j - leave this hunk undecided, see next undecided hunk\r
522 J - leave this hunk undecided, see next hunk\r
523 k - leave this hunk undecided, see previous undecided hunk\r
524 K - leave this hunk undecided, see previous hunk\r
525 s - split the current hunk into smaller hunks\r
526 e - manually edit the current hunk\r
527 p - print the current hunk\r
528 ? - print help</literallayout>\r
529 <simpara>After deciding the fate for all hunks, if there is any hunk\r
530 that was chosen, the index is updated with the selected hunks.</simpara>\r
531 <simpara>You can omit having to type return here, by setting the configuration\r
532 variable <emphasis>interactive.singleKey</emphasis> to <emphasis>true</emphasis>.</simpara>\r
533 </listitem>\r
534 </varlistentry>\r
535 <varlistentry>\r
536 <term>\r
537 diff\r
538 </term>\r
539 <listitem>\r
540 <simpara>\r
541   This lets you review what will be committed (i.e. between\r
542   HEAD and index).\r
543 </simpara>\r
544 </listitem>\r
545 </varlistentry>\r
546 </variablelist>\r
547 </simplesect>\r
548 <simplesect id="git-add(1)__editing_patches">\r
549 <title>EDITING PATCHES</title>\r
550 <simpara>Invoking <emphasis>git add -e</emphasis> or selecting <emphasis>e</emphasis> from the interactive hunk\r
551 selector will open a patch in your editor; after the editor exits, the\r
552 result is applied to the index. You are free to make arbitrary changes\r
553 to the patch, but note that some changes may have confusing results, or\r
554 even result in a patch that cannot be applied.  If you want to abort the\r
555 operation entirely (i.e., stage nothing new in the index), simply delete\r
556 all lines of the patch. The list below describes some common things you\r
557 may see in a patch, and which editing operations make sense on them.</simpara>\r
558 <variablelist>\r
559 <varlistentry>\r
560 <term>\r
561 added content\r
562 </term>\r
563 <listitem>\r
564 <simpara>\r
565 Added content is represented by lines beginning with "&#43;". You can\r
566 prevent staging any addition lines by deleting them.\r
567 </simpara>\r
568 </listitem>\r
569 </varlistentry>\r
570 <varlistentry>\r
571 <term>\r
572 removed content\r
573 </term>\r
574 <listitem>\r
575 <simpara>\r
576 Removed content is represented by lines beginning with "-". You can\r
577 prevent staging their removal by converting the "-" to a " " (space).\r
578 </simpara>\r
579 </listitem>\r
580 </varlistentry>\r
581 <varlistentry>\r
582 <term>\r
583 modified content\r
584 </term>\r
585 <listitem>\r
586 <simpara>\r
587 Modified content is represented by "-" lines (removing the old content)\r
588 followed by "&#43;" lines (adding the replacement content). You can\r
589 prevent staging the modification by converting "-" lines to " ", and\r
590 removing "&#43;" lines. Beware that modifying only half of the pair is\r
591 likely to introduce confusing changes to the index.\r
592 </simpara>\r
593 </listitem>\r
594 </varlistentry>\r
595 </variablelist>\r
596 <simpara>There are also more complex operations that can be performed. But beware\r
597 that because the patch is applied only to the index and not the working\r
598 tree, the working tree will appear to "undo" the change in the index.\r
599 For example, introducing a new line into the index that is in neither\r
600 the HEAD nor the working tree will stage the new line for commit, but\r
601 the line will appear to be reverted in the working tree.</simpara>\r
602 <simpara>Avoid using these constructs, or do so with extreme caution.</simpara>\r
603 <variablelist>\r
604 <varlistentry>\r
605 <term>\r
606 removing untouched content\r
607 </term>\r
608 <listitem>\r
609 <simpara>\r
610 Content which does not differ between the index and working tree may be\r
611 shown on context lines, beginning with a " " (space).  You can stage\r
612 context lines for removal by converting the space to a "-". The\r
613 resulting working tree file will appear to re-add the content.\r
614 </simpara>\r
615 </listitem>\r
616 </varlistentry>\r
617 <varlistentry>\r
618 <term>\r
619 modifying existing content\r
620 </term>\r
621 <listitem>\r
622 <simpara>\r
623 One can also modify context lines by staging them for removal (by\r
624 converting " " to "-") and adding a "&#43;" line with the new content.\r
625 Similarly, one can modify "&#43;" lines for existing additions or\r
626 modifications. In all cases, the new modification will appear reverted\r
627 in the working tree.\r
628 </simpara>\r
629 </listitem>\r
630 </varlistentry>\r
631 <varlistentry>\r
632 <term>\r
633 new content\r
634 </term>\r
635 <listitem>\r
636 <simpara>\r
637 You may also add new content that does not exist in the patch; simply\r
638 add new lines, each starting with "&#43;". The addition will appear\r
639 reverted in the working tree.\r
640 </simpara>\r
641 </listitem>\r
642 </varlistentry>\r
643 </variablelist>\r
644 <simpara>There are also several operations which should be avoided entirely, as\r
645 they will make the patch impossible to apply:</simpara>\r
646 <itemizedlist>\r
647 <listitem>\r
648 <simpara>\r
649 adding context (" ") or removal ("-") lines\r
650 </simpara>\r
651 </listitem>\r
652 <listitem>\r
653 <simpara>\r
654 deleting context or removal lines\r
655 </simpara>\r
656 </listitem>\r
657 <listitem>\r
658 <simpara>\r
659 modifying the contents of context or removal lines\r
660 </simpara>\r
661 </listitem>\r
662 </itemizedlist>\r
663 </simplesect>\r
664 <simplesect id="git-add(1)__configuration">\r
665 <title>CONFIGURATION</title>\r
666 <simpara>Everything below this line in this section is selectively included\r
667 from the <xref linkend="git-config(1)" /> documentation. The content is the same\r
668 as what's found there:</simpara>\r
669 <variablelist>\r
670 <varlistentry>\r
671 <term>\r
672 add.ignoreErrors\r
673 </term>\r
674 <term>\r
675 add.ignore-errors (deprecated)\r
676 </term>\r
677 <listitem>\r
678 <simpara>\r
679         Tells <emphasis>git add</emphasis> to continue adding files when some files cannot be\r
680         added due to indexing errors. Equivalent to the <emphasis>--ignore-errors</emphasis>\r
681         option of <xref linkend="git-add(1)" />.  <emphasis>add.ignore-errors</emphasis> is deprecated,\r
682         as it does not follow the usual naming convention for configuration\r
683         variables.\r
684 </simpara>\r
685 </listitem>\r
686 </varlistentry>\r
687 <varlistentry>\r
688 <term>\r
689 add.interactive.useBuiltin\r
690 </term>\r
691 <listitem>\r
692 <simpara>\r
693         Unused configuration variable. Used in Git versions v2.25.0 to\r
694         v2.36.0 to enable the built-in version of <xref linkend="git-add(1)" />'s\r
695         interactive mode, which then became the default in Git\r
696         versions v2.37.0 to v2.39.0.\r
697 </simpara>\r
698 </listitem>\r
699 </varlistentry>\r
700 </variablelist>\r
701 </simplesect>\r
702 <simplesect id="git-add(1)__see_also">\r
703 <title>SEE ALSO</title>\r
704 <simpara><xref linkend="git-status(1)" />\r
705 <xref linkend="git-rm(1)" />\r
706 <xref linkend="git-reset(1)" />\r
707 <xref linkend="git-mv(1)" />\r
708 <xref linkend="git-commit(1)" />\r
709 <xref linkend="git-update-index(1)" /></simpara>\r
710 </simplesect>\r
711 <simplesect id="git-add(1)__git">\r
712 <title>GIT</title>\r
713 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>\r
714 </simplesect>\r
715 </sect2>\r