blob: 1514e39e97487f213a5aa866bdf6f29d70a2e14c [file] [log] [blame]
Junio C Hamanob9d9d902018-05-23 07:07:421<?xml version="1.0" encoding="UTF-8"?>
Junio C Hamano1a4e8412005-12-27 08:17:232<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5<head>
Junio C Hamano9d971152012-12-19 00:43:116<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
Junio C Hamanoa85030a2022-07-27 16:48:217<meta name="generator" content="AsciiDoc 10.2.0" />
Junio C Hamano97bcb482010-11-25 03:16:078<title>git-add(1)</title>
Junio C Hamano1a4e8412005-12-27 08:17:239<style type="text/css">
Junio C Hamano9d971152012-12-19 00:43:1110/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
11
12/* Default font. */
13body {
14 font-family: Georgia,serif;
15}
16
17/* Title font. */
18h1, h2, h3, h4, h5, h6,
19div.title, caption.title,
20thead, p.table.header,
21#toctitle,
22#author, #revnumber, #revdate, #revremark,
23#footer {
24 font-family: Arial,Helvetica,sans-serif;
Junio C Hamano1a4e8412005-12-27 08:17:2325}
26
27body {
28 margin: 1em 5% 1em 5%;
29}
30
Junio C Hamano46a38aa2008-07-14 03:13:2731a {
32 color: blue;
33 text-decoration: underline;
34}
35a:visited {
36 color: fuchsia;
37}
Junio C Hamano1a4e8412005-12-27 08:17:2338
39em {
40 font-style: italic;
Junio C Hamano97bcb482010-11-25 03:16:0741 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2342}
43
44strong {
45 font-weight: bold;
Junio C Hamano97bcb482010-11-25 03:16:0746 color: #083194;
Junio C Hamano1a4e8412005-12-27 08:17:2347}
48
Junio C Hamano1a4e8412005-12-27 08:17:2349h1, h2, h3, h4, h5, h6 {
50 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:2351 margin-top: 1.2em;
52 margin-bottom: 0.5em;
53 line-height: 1.3;
54}
55
Junio C Hamano46a38aa2008-07-14 03:13:2756h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2357 border-bottom: 2px solid silver;
58}
59h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2360 padding-top: 0.5em;
61}
Junio C Hamano46a38aa2008-07-14 03:13:2762h3 {
63 float: left;
64}
65h3 + * {
66 clear: left;
67}
Junio C Hamano9d971152012-12-19 00:43:1168h5 {
69 font-size: 1.0em;
70}
Junio C Hamano1a4e8412005-12-27 08:17:2371
72div.sectionbody {
Junio C Hamano1a4e8412005-12-27 08:17:2373 margin-left: 0;
74}
75
76hr {
77 border: 1px solid silver;
78}
79
80p {
81 margin-top: 0.5em;
82 margin-bottom: 0.5em;
83}
84
Junio C Hamano97bcb482010-11-25 03:16:0785ul, ol, li > p {
86 margin-top: 0;
87}
Junio C Hamano9d971152012-12-19 00:43:1188ul > li { color: #aaa; }
89ul > li > * { color: black; }
Junio C Hamano97bcb482010-11-25 03:16:0790
Junio C Hamanoc14e6ad2014-10-31 20:25:5391.monospaced, code, pre {
92 font-family: "Courier New", Courier, monospace;
93 font-size: inherit;
94 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2395 padding: 0;
96 margin: 0;
97}
Junio C Hamanoc14e6ad2014-10-31 20:25:5398pre {
99 white-space: pre-wrap;
100}
Junio C Hamano1a4e8412005-12-27 08:17:23101
Junio C Hamano9d971152012-12-19 00:43:11102#author {
Junio C Hamano1a4e8412005-12-27 08:17:23103 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23104 font-weight: bold;
Junio C Hamano46a38aa2008-07-14 03:13:27105 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23106}
Junio C Hamano9d971152012-12-19 00:43:11107#email {
Junio C Hamano1a4e8412005-12-27 08:17:23108}
Junio C Hamano9d971152012-12-19 00:43:11109#revnumber, #revdate, #revremark {
Junio C Hamano1a4e8412005-12-27 08:17:23110}
111
Junio C Hamano9d971152012-12-19 00:43:11112#footer {
Junio C Hamano1a4e8412005-12-27 08:17:23113 font-size: small;
114 border-top: 2px solid silver;
115 padding-top: 0.5em;
116 margin-top: 4.0em;
117}
Junio C Hamano9d971152012-12-19 00:43:11118#footer-text {
Junio C Hamano1a4e8412005-12-27 08:17:23119 float: left;
120 padding-bottom: 0.5em;
121}
Junio C Hamano9d971152012-12-19 00:43:11122#footer-badges {
Junio C Hamano1a4e8412005-12-27 08:17:23123 float: right;
124 padding-bottom: 0.5em;
125}
126
Junio C Hamano9d971152012-12-19 00:43:11127#preamble {
Junio C Hamano97bcb482010-11-25 03:16:07128 margin-top: 1.5em;
129 margin-bottom: 1.5em;
130}
Junio C Hamano9d971152012-12-19 00:43:11131div.imageblock, div.exampleblock, div.verseblock,
Junio C Hamano1a4e8412005-12-27 08:17:23132div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22134 margin-top: 1.0em;
Junio C Hamano1a4e8412005-12-27 08:17:23135 margin-bottom: 1.5em;
136}
137div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22138 margin-top: 2.0em;
139 margin-bottom: 2.0em;
140 margin-right: 10%;
141 color: #606060;
Junio C Hamano1a4e8412005-12-27 08:17:23142}
143
144div.content { /* Block element content. */
145 padding: 0;
146}
147
148/* Block element titles. */
149div.title, caption.title {
Junio C Hamano97bcb482010-11-25 03:16:07150 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23151 font-weight: bold;
152 text-align: left;
153 margin-top: 1.0em;
154 margin-bottom: 0.5em;
155}
156div.title + * {
157 margin-top: 0;
158}
159
160td div.title:first-child {
161 margin-top: 0.0em;
162}
163div.content div.title:first-child {
164 margin-top: 0.0em;
165}
166div.content + div.title {
167 margin-top: 0.0em;
168}
169
170div.sidebarblock > div.content {
171 background: #ffffee;
Junio C Hamano9d971152012-12-19 00:43:11172 border: 1px solid #dddddd;
173 border-left: 4px solid #f0f0f0;
Junio C Hamano1a4e8412005-12-27 08:17:23174 padding: 0.5em;
175}
176
177div.listingblock > div.content {
Junio C Hamano9d971152012-12-19 00:43:11178 border: 1px solid #dddddd;
179 border-left: 5px solid #f0f0f0;
180 background: #f8f8f8;
Junio C Hamano1a4e8412005-12-27 08:17:23181 padding: 0.5em;
182}
183
Junio C Hamano7bd050f2011-09-22 06:32:22184div.quoteblock, div.verseblock {
185 padding-left: 1.0em;
186 margin-left: 1.0em;
Junio C Hamano97bcb482010-11-25 03:16:07187 margin-right: 10%;
Junio C Hamano9d971152012-12-19 00:43:11188 border-left: 5px solid #f0f0f0;
189 color: #888;
Junio C Hamano1a4e8412005-12-27 08:17:23190}
Junio C Hamano7bd050f2011-09-22 06:32:22191
Junio C Hamano97bcb482010-11-25 03:16:07192div.quoteblock > div.attribution {
193 padding-top: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23194 text-align: right;
195}
Junio C Hamano97bcb482010-11-25 03:16:07196
Junio C Hamano9d971152012-12-19 00:43:11197div.verseblock > pre.content {
198 font-family: inherit;
199 font-size: inherit;
Junio C Hamano97bcb482010-11-25 03:16:07200}
201div.verseblock > div.attribution {
202 padding-top: 0.75em;
203 text-align: left;
204}
205/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamano46a38aa2008-07-14 03:13:27206div.verseblock + div.attribution {
207 text-align: left;
208}
Junio C Hamano1a4e8412005-12-27 08:17:23209
210div.admonitionblock .icon {
211 vertical-align: top;
212 font-size: 1.1em;
213 font-weight: bold;
214 text-decoration: underline;
215 color: #527bbd;
216 padding-right: 0.5em;
217}
218div.admonitionblock td.content {
219 padding-left: 0.5em;
Junio C Hamano7bd050f2011-09-22 06:32:22220 border-left: 3px solid #dddddd;
Junio C Hamano1a4e8412005-12-27 08:17:23221}
222
223div.exampleblock > div.content {
Junio C Hamano7bd050f2011-09-22 06:32:22224 border-left: 3px solid #dddddd;
225 padding-left: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23226}
227
Junio C Hamano1a4e8412005-12-27 08:17:23228div.imageblock div.content { padding-left: 0; }
Junio C Hamanoc14e6ad2014-10-31 20:25:53229span.image img { border-style: none; vertical-align: text-bottom; }
Junio C Hamano97bcb482010-11-25 03:16:07230a.image:visited { color: white; }
Junio C Hamano1a4e8412005-12-27 08:17:23231
232dl {
233 margin-top: 0.8em;
234 margin-bottom: 0.8em;
235}
236dt {
237 margin-top: 0.5em;
238 margin-bottom: 0;
Junio C Hamano97bcb482010-11-25 03:16:07239 font-style: normal;
240 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23241}
242dd > *:first-child {
Junio C Hamano97bcb482010-11-25 03:16:07243 margin-top: 0.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23244}
245
246ul, ol {
247 list-style-position: outside;
248}
Junio C Hamano97bcb482010-11-25 03:16:07249ol.arabic {
250 list-style-type: decimal;
251}
252ol.loweralpha {
Junio C Hamano1a4e8412005-12-27 08:17:23253 list-style-type: lower-alpha;
254}
Junio C Hamano97bcb482010-11-25 03:16:07255ol.upperalpha {
256 list-style-type: upper-alpha;
257}
258ol.lowerroman {
259 list-style-type: lower-roman;
260}
261ol.upperroman {
262 list-style-type: upper-roman;
263}
264
265div.compact ul, div.compact ol,
266div.compact p, div.compact p,
267div.compact div, div.compact div {
268 margin-top: 0.1em;
269 margin-bottom: 0.1em;
270}
Junio C Hamano1a4e8412005-12-27 08:17:23271
Junio C Hamano1a4e8412005-12-27 08:17:23272tfoot {
273 font-weight: bold;
274}
Junio C Hamano97bcb482010-11-25 03:16:07275td > div.verse {
276 white-space: pre;
277}
Junio C Hamano97bcb482010-11-25 03:16:07278
279div.hdlist {
Junio C Hamano1a4e8412005-12-27 08:17:23280 margin-top: 0.8em;
281 margin-bottom: 0.8em;
282}
Junio C Hamano97bcb482010-11-25 03:16:07283div.hdlist tr {
284 padding-bottom: 15px;
Junio C Hamano46a38aa2008-07-14 03:13:27285}
Junio C Hamano97bcb482010-11-25 03:16:07286dt.hdlist1.strong, td.hdlist1.strong {
287 font-weight: bold;
288}
289td.hdlist1 {
Junio C Hamano1a4e8412005-12-27 08:17:23290 vertical-align: top;
Junio C Hamano97bcb482010-11-25 03:16:07291 font-style: normal;
Junio C Hamano1a4e8412005-12-27 08:17:23292 padding-right: 0.8em;
Junio C Hamano97bcb482010-11-25 03:16:07293 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23294}
Junio C Hamano97bcb482010-11-25 03:16:07295td.hdlist2 {
Junio C Hamano1a4e8412005-12-27 08:17:23296 vertical-align: top;
297}
Junio C Hamano97bcb482010-11-25 03:16:07298div.hdlist.compact tr {
299 margin: 0;
300 padding-bottom: 0;
301}
302
303.comment {
304 background: yellow;
305}
Junio C Hamano1a4e8412005-12-27 08:17:23306
Junio C Hamano7bd050f2011-09-22 06:32:22307.footnote, .footnoteref {
308 font-size: 0.8em;
309}
310
311span.footnote, span.footnoteref {
312 vertical-align: super;
313}
314
315#footnotes {
316 margin: 20px 0 20px 0;
317 padding: 7px 0 0 0;
318}
319
320#footnotes div.footnote {
321 margin: 0 0 5px 0;
322}
323
324#footnotes hr {
325 border: none;
326 border-top: 1px solid silver;
327 height: 1px;
328 text-align: left;
329 margin-left: 0;
330 width: 20%;
331 min-width: 100px;
332}
333
Junio C Hamano9d971152012-12-19 00:43:11334div.colist td {
335 padding-right: 0.5em;
336 padding-bottom: 0.3em;
337 vertical-align: top;
338}
339div.colist td img {
340 margin-top: 0.3em;
Junio C Hamano1a4e8412005-12-27 08:17:23341}
Junio C Hamano46a38aa2008-07-14 03:13:27342
Junio C Hamano9d971152012-12-19 00:43:11343@media print {
344 #footer-badges { display: none; }
345}
346
347#toc {
Junio C Hamano7bd050f2011-09-22 06:32:22348 margin-bottom: 2.5em;
349}
350
Junio C Hamano9d971152012-12-19 00:43:11351#toctitle {
Junio C Hamano46a38aa2008-07-14 03:13:27352 color: #527bbd;
Junio C Hamano46a38aa2008-07-14 03:13:27353 font-size: 1.1em;
354 font-weight: bold;
355 margin-top: 1.0em;
356 margin-bottom: 0.1em;
357}
358
Junio C Hamanoc14e6ad2014-10-31 20:25:53359div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
Junio C Hamano46a38aa2008-07-14 03:13:27360 margin-top: 0;
361 margin-bottom: 0;
362}
363div.toclevel2 {
364 margin-left: 2em;
365 font-size: 0.9em;
366}
367div.toclevel3 {
368 margin-left: 4em;
369 font-size: 0.9em;
370}
371div.toclevel4 {
372 margin-left: 6em;
373 font-size: 0.9em;
374}
Junio C Hamano9d971152012-12-19 00:43:11375
376span.aqua { color: aqua; }
377span.black { color: black; }
378span.blue { color: blue; }
379span.fuchsia { color: fuchsia; }
380span.gray { color: gray; }
381span.green { color: green; }
382span.lime { color: lime; }
383span.maroon { color: maroon; }
384span.navy { color: navy; }
385span.olive { color: olive; }
386span.purple { color: purple; }
387span.red { color: red; }
388span.silver { color: silver; }
389span.teal { color: teal; }
390span.white { color: white; }
391span.yellow { color: yellow; }
392
393span.aqua-background { background: aqua; }
394span.black-background { background: black; }
395span.blue-background { background: blue; }
396span.fuchsia-background { background: fuchsia; }
397span.gray-background { background: gray; }
398span.green-background { background: green; }
399span.lime-background { background: lime; }
400span.maroon-background { background: maroon; }
401span.navy-background { background: navy; }
402span.olive-background { background: olive; }
403span.purple-background { background: purple; }
404span.red-background { background: red; }
405span.silver-background { background: silver; }
406span.teal-background { background: teal; }
407span.white-background { background: white; }
408span.yellow-background { background: yellow; }
409
410span.big { font-size: 2em; }
411span.small { font-size: 0.6em; }
412
413span.underline { text-decoration: underline; }
414span.overline { text-decoration: overline; }
415span.line-through { text-decoration: line-through; }
416
Junio C Hamanoc14e6ad2014-10-31 20:25:53417div.unbreakable { page-break-inside: avoid; }
418
Junio C Hamano9d971152012-12-19 00:43:11419
420/*
421 * xhtml11 specific
422 *
423 * */
424
425div.tableblock {
426 margin-top: 1.0em;
427 margin-bottom: 1.5em;
428}
429div.tableblock > table {
430 border: 3px solid #527bbd;
431}
432thead, p.table.header {
433 font-weight: bold;
434 color: #527bbd;
435}
436p.table {
437 margin-top: 0;
438}
Junio C Hamano725b0da2020-01-22 22:02:40439/* Because the table frame attribute is overridden by CSS in most browsers. */
Junio C Hamano9d971152012-12-19 00:43:11440div.tableblock > table[frame="void"] {
441 border-style: none;
442}
443div.tableblock > table[frame="hsides"] {
444 border-left-style: none;
445 border-right-style: none;
446}
447div.tableblock > table[frame="vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
450}
451
452
453/*
454 * html5 specific
455 *
456 * */
457
458table.tableblock {
459 margin-top: 1.0em;
460 margin-bottom: 1.5em;
461}
462thead, p.tableblock.header {
463 font-weight: bold;
464 color: #527bbd;
465}
466p.tableblock {
467 margin-top: 0;
468}
469table.tableblock {
470 border-width: 3px;
471 border-spacing: 0px;
472 border-style: solid;
473 border-color: #527bbd;
474 border-collapse: collapse;
475}
476th.tableblock, td.tableblock {
477 border-width: 1px;
478 padding: 4px;
479 border-style: solid;
480 border-color: #527bbd;
481}
482
483table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
486}
487table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
490}
491table.tableblock.frame-none {
492 border-style: hidden;
493}
494
495th.tableblock.halign-left, td.tableblock.halign-left {
496 text-align: left;
497}
498th.tableblock.halign-center, td.tableblock.halign-center {
499 text-align: center;
500}
501th.tableblock.halign-right, td.tableblock.halign-right {
502 text-align: right;
503}
504
505th.tableblock.valign-top, td.tableblock.valign-top {
506 vertical-align: top;
507}
508th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
510}
511th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
513}
514
515
516/*
517 * manpage specific
518 *
519 * */
520
521body.manpage h1 {
Junio C Hamano97bcb482010-11-25 03:16:07522 padding-top: 0.5em;
523 padding-bottom: 0.5em;
524 border-top: 2px solid silver;
525 border-bottom: 2px solid silver;
526}
Junio C Hamano9d971152012-12-19 00:43:11527body.manpage h2 {
Junio C Hamano97bcb482010-11-25 03:16:07528 border-style: none;
529}
Junio C Hamano9d971152012-12-19 00:43:11530body.manpage div.sectionbody {
531 margin-left: 3em;
Junio C Hamano97bcb482010-11-25 03:16:07532}
533
534@media print {
Junio C Hamano9d971152012-12-19 00:43:11535 body.manpage div#toc { display: none; }
Junio C Hamano97bcb482010-11-25 03:16:07536}
Junio C Hamanoc14e6ad2014-10-31 20:25:53537
538
Junio C Hamano1a4e8412005-12-27 08:17:23539</style>
Junio C Hamano7bd050f2011-09-22 06:32:22540<script type="text/javascript">
541/*<![CDATA[*/
Junio C Hamano2b153182021-12-15 21:00:31542var asciidoc = { // Namespace.
543
544/////////////////////////////////////////////////////////////////////
545// Table Of Contents generator
546/////////////////////////////////////////////////////////////////////
547
548/* Author: Mihai Bazon, September 2002
549 * http://students.infoiasi.ro/~mishoo
550 *
551 * Table Of Content generator
552 * Version: 0.4
553 *
554 * Feel free to use this script under the terms of the GNU General Public
555 * License, as long as you do not remove or alter this notice.
556 */
557
558 /* modified by Troy D. Hanson, September 2006. License: GPL */
559 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
560
561// toclevels = 1..4.
562toc: function (toclevels) {
563
564 function getText(el) {
565 var text = "";
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
568 text += i.data;
569 else if (i.firstChild != null)
570 text += getText(i);
571 }
572 return text;
573 }
574
575 function TocEntry(el, text, toclevel) {
576 this.element = el;
577 this.text = text;
578 this.toclevel = toclevel;
579 }
580
581 function tocEntries(el, toclevels) {
582 var result = new Array;
583 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
584 // Function that scans the DOM tree for header elements (the DOM2
585 // nodeIterator API would be a better technique but not supported by all
586 // browsers).
587 var iterate = function (el) {
588 for (var i = el.firstChild; i != null; i = i.nextSibling) {
589 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
590 var mo = re.exec(i.tagName);
591 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
592 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
593 }
594 iterate(i);
595 }
596 }
597 }
598 iterate(el);
599 return result;
600 }
601
602 var toc = document.getElementById("toc");
603 if (!toc) {
604 return;
605 }
606
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
609 var i;
610 for (i = 0; i < toc.childNodes.length; i++) {
611 var entry = toc.childNodes[i];
612 if (entry.nodeName.toLowerCase() == 'div'
613 && entry.getAttribute("class")
614 && entry.getAttribute("class").match(/^toclevel/))
615 tocEntriesToRemove.push(entry);
616 }
617 for (i = 0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
619 }
620
621 // Rebuild TOC entries.
622 var entries = tocEntries(document.getElementById("content"), toclevels);
623 for (var i = 0; i < entries.length; ++i) {
624 var entry = entries[i];
625 if (entry.element.id == "")
626 entry.element.id = "_toc_" + i;
627 var a = document.createElement("a");
628 a.href = "#" + entry.element.id;
629 a.appendChild(document.createTextNode(entry.text));
630 var div = document.createElement("div");
631 div.appendChild(a);
632 div.className = "toclevel" + entry.toclevel;
633 toc.appendChild(div);
634 }
635 if (entries.length == 0)
636 toc.parentNode.removeChild(toc);
637},
638
639
640/////////////////////////////////////////////////////////////////////
641// Footnotes generator
642/////////////////////////////////////////////////////////////////////
643
644/* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
646 */
647
648footnotes: function () {
649 // Delete existing footnote entries in case we're reloading the footnodes.
650 var i;
651 var noteholder = document.getElementById("footnotes");
652 if (!noteholder) {
653 return;
654 }
655 var entriesToRemove = [];
656 for (i = 0; i < noteholder.childNodes.length; i++) {
657 var entry = noteholder.childNodes[i];
658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
659 entriesToRemove.push(entry);
660 }
661 for (i = 0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
663 }
664
665 // Rebuild footnote entries.
666 var cont = document.getElementById("content");
667 var spans = cont.getElementsByTagName("span");
668 var refs = {};
669 var n = 0;
670 for (i=0; i<spans.length; i++) {
671 if (spans[i].className == "footnote") {
672 n++;
673 var note = spans[i].getAttribute("data-note");
674 if (!note) {
675 // Use [\s\S] in place of . so multi-line matches work.
676 // Because JavaScript has no s (dotall) regex flag.
677 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
678 spans[i].innerHTML =
679 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
680 "' title='View footnote' class='footnote'>" + n + "</a>]";
681 spans[i].setAttribute("data-note", note);
682 }
683 noteholder.innerHTML +=
684 "<div class='footnote' id='_footnote_" + n + "'>" +
685 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
686 n + "</a>. " + note + "</div>";
687 var id =spans[i].getAttribute("id");
688 if (id != null) refs["#"+id] = n;
689 }
690 }
691 if (n == 0)
692 noteholder.parentNode.removeChild(noteholder);
693 else {
694 // Process footnoterefs.
695 for (i=0; i<spans.length; i++) {
696 if (spans[i].className == "footnoteref") {
697 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
698 href = href.match(/#.*/)[0]; // Because IE return full URL.
699 n = refs[href];
700 spans[i].innerHTML =
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n + "</a>]";
703 }
704 }
705 }
706},
707
708install: function(toclevels) {
709 var timerId;
710
711 function reinstall() {
712 asciidoc.footnotes();
713 if (toclevels) {
714 asciidoc.toc(toclevels);
715 }
716 }
717
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
720 reinstall();
721 }
722
723 timerId = setInterval(reinstall, 500);
724 if (document.addEventListener)
725 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
726 else
727 window.onload = reinstallAndRemoveTimer;
728}
729
730}
Junio C Hamano9d971152012-12-19 00:43:11731asciidoc.install();
Junio C Hamano7bd050f2011-09-22 06:32:22732/*]]>*/
733</script>
Junio C Hamano1a4e8412005-12-27 08:17:23734</head>
Junio C Hamano9d971152012-12-19 00:43:11735<body class="manpage">
Junio C Hamano1a4e8412005-12-27 08:17:23736<div id="header">
737<h1>
738git-add(1) Manual Page
739</h1>
740<h2>NAME</h2>
741<div class="sectionbody">
742<p>git-add -
Junio C Hamano4cd1c0e2007-08-06 04:39:14743 Add file contents to the index
Junio C Hamano1a4e8412005-12-27 08:17:23744</p>
745</div>
746</div>
Junio C Hamano7bd050f2011-09-22 06:32:22747<div id="content">
Junio C Hamano9d971152012-12-19 00:43:11748<div class="sect1">
Junio C Hamano97bcb482010-11-25 03:16:07749<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23750<div class="sectionbody">
Junio C Hamano8b8b0f22007-08-26 22:10:26751<div class="verseblock">
Junio C Hamanoe8acc8e2015-01-14 22:01:34752<pre class="content"><em>git add</em> [--verbose | -v] [--dry-run | -n] [--force | -f] [--interactive | -i] [--patch | -p]
Junio C Hamano7b1585b2021-10-14 17:11:58753 [--edit | -e] [--[no-]all | --[no-]ignore-removal | [--update | -u]] [--sparse]
Junio C Hamano4886c772017-11-27 03:33:28754 [--intent-to-add | -N] [--refresh] [--ignore-errors] [--ignore-missing] [--renormalize]
Junio C Hamano2f5a9892019-12-25 21:12:55755 [--chmod=(+|-)x] [--pathspec-from-file=&lt;file&gt; [--pathspec-file-nul]]
756 [--] [&lt;pathspec&gt;&#8230;]</pre>
Junio C Hamano9d971152012-12-19 00:43:11757<div class="attribution">
Junio C Hamano97bcb482010-11-25 03:16:07758</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23759</div>
Junio C Hamano9d971152012-12-19 00:43:11760</div>
761<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:27762<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23763<div class="sectionbody">
Junio C Hamano97bcb482010-11-25 03:16:07764<div class="paragraph"><p>This command updates the index using the current content found in
Junio C Hamanoae05fee2010-01-08 07:39:46765the working tree, to prepare the content staged for the next commit.
766It typically adds the current content of existing paths as a whole,
767but with some options it can also be used to add content with
768only part of the changes made to the working tree files applied, or
769remove paths that do not exist in the working tree anymore.</p></div>
Junio C Hamano97bcb482010-11-25 03:16:07770<div class="paragraph"><p>The "index" holds a snapshot of the content of the working tree, and it
Junio C Hamano4cd1c0e2007-08-06 04:39:14771is this snapshot that is taken as the contents of the next commit. Thus
Junio C Hamanoffe10ca2016-02-04 00:44:23772after making any changes to the working tree, and before running
Junio C Hamanoc14e6ad2014-10-31 20:25:53773the commit command, you must use the <code>add</code> command to add any new or
Junio C Hamano46a38aa2008-07-14 03:13:27774modified files to the index.</p></div>
Junio C Hamano97bcb482010-11-25 03:16:07775<div class="paragraph"><p>This command can be performed multiple times before a commit. It only
Junio C Hamano4cd1c0e2007-08-06 04:39:14776adds the content of the specified file(s) at the time the add command is
777run; if you want subsequent changes included in the next commit, then
Junio C Hamanoc14e6ad2014-10-31 20:25:53778you must run <code>git add</code> again to add the new content to the index.</p></div>
779<div class="paragraph"><p>The <code>git status</code> command can be used to obtain a summary of which
Junio C Hamano46a38aa2008-07-14 03:13:27780files have changes that are staged for the next commit.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:53781<div class="paragraph"><p>The <code>git add</code> command will not add ignored files by default. If any
782ignored files were explicitly specified on the command line, <code>git add</code>
Junio C Hamano3c1f2c72007-08-17 07:48:05783will fail with a list of ignored files. Ignored files reached by
Junio C Hamano7d9e9bd2007-08-29 07:31:47784directory recursion or filename globbing performed by Git (quote your
Junio C Hamano1aa40d22010-01-21 17:46:43785globs before the shell) will be silently ignored. The <em>git add</em> command can
Junio C Hamanoc14e6ad2014-10-31 20:25:53786be used to add ignored files with the <code>-f</code> (force) option.</p></div>
Junio C Hamanoa28a9202012-06-21 07:08:23787<div class="paragraph"><p>Please see <a href="git-commit.html">git-commit(1)</a> for alternative ways to add content to a
Junio C Hamano46a38aa2008-07-14 03:13:27788commit.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23789</div>
Junio C Hamano9d971152012-12-19 00:43:11790</div>
791<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:27792<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23793<div class="sectionbody">
Junio C Hamano97bcb482010-11-25 03:16:07794<div class="dlist"><dl>
795<dt class="hdlist1">
Junio C Hamanobca4cd62013-02-13 00:01:02796&lt;pathspec&gt;&#8230;
Junio C Hamano1a4e8412005-12-27 08:17:23797</dt>
798<dd>
799<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53800 Files to add content from. Fileglobs (e.g. <code>*.c</code>) can
Junio C Hamano3d2adc72006-12-26 03:21:45801 be given to add all matching files. Also a
Junio C Hamanoc14e6ad2014-10-31 20:25:53802 leading directory name (e.g. <code>dir</code> to add <code>dir/file1</code>
803 and <code>dir/file2</code>) can be given to update the index to
Junio C Hamano1d669b82014-03-11 21:36:00804 match the current state of the directory as a whole (e.g.
Junio C Hamanoc14e6ad2014-10-31 20:25:53805 specifying <code>dir</code> will record not just a file <code>dir/file1</code>
806 modified in the working tree, a file <code>dir/file2</code> added to
807 the working tree, but also a file <code>dir/file3</code> removed from
Junio C Hamano2567b322019-02-05 23:33:56808 the working tree). Note that older versions of Git used
Junio C Hamanoc14e6ad2014-10-31 20:25:53809 to ignore removed files; use <code>--no-all</code> option if you want
Junio C Hamano1d669b82014-03-11 21:36:00810 to add modified or new files but ignore removed ones.
Junio C Hamano1a4e8412005-12-27 08:17:23811</p>
Junio C Hamano139b7d12017-10-03 07:10:59812<div class="paragraph"><p>For more details about the &lt;pathspec&gt; syntax, see the <em>pathspec</em> entry
813in <a href="gitglossary.html">gitglossary(7)</a>.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23814</dd>
Junio C Hamano97bcb482010-11-25 03:16:07815<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47816-n
817</dt>
Junio C Hamano97bcb482010-11-25 03:16:07818<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47819--dry-run
Junio C Hamano1a4e8412005-12-27 08:17:23820</dt>
821<dd>
822<p>
Junio C Hamano97bcb482010-11-25 03:16:07823 Don&#8217;t actually add the file(s), just show if they exist and/or will
Junio C Hamanoafabd322010-07-19 20:26:15824 be ignored.
Junio C Hamano1a4e8412005-12-27 08:17:23825</p>
826</dd>
Junio C Hamano97bcb482010-11-25 03:16:07827<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47828-v
829</dt>
Junio C Hamano97bcb482010-11-25 03:16:07830<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47831--verbose
Junio C Hamano1a4e8412005-12-27 08:17:23832</dt>
833<dd>
834<p>
835 Be verbose.
836</p>
837</dd>
Junio C Hamano97bcb482010-11-25 03:16:07838<dt class="hdlist1">
Junio C Hamano3d2adc72006-12-26 03:21:45839-f
840</dt>
Junio C Hamano97bcb482010-11-25 03:16:07841<dt class="hdlist1">
Junio C Hamano00e884a2008-06-15 05:10:38842--force
843</dt>
Junio C Hamano3d2adc72006-12-26 03:21:45844<dd>
845<p>
846 Allow adding otherwise ignored files.
847</p>
848</dd>
Junio C Hamano97bcb482010-11-25 03:16:07849<dt class="hdlist1">
Junio C Hamano7b1585b2021-10-14 17:11:58850--sparse
851</dt>
852<dd>
853<p>
854 Allow updating index entries outside of the sparse-checkout cone.
855 Normally, <code>git add</code> refuses to update index entries whose paths do
856 not fit within the sparse-checkout cone, since those files might
857 be removed from the working tree without warning. See
858 <a href="git-sparse-checkout.html">git-sparse-checkout(1)</a> for more details.
859</p>
860</dd>
861<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47862-i
863</dt>
Junio C Hamano97bcb482010-11-25 03:16:07864<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47865--interactive
Junio C Hamano17bbaca2006-12-25 11:36:31866</dt>
867<dd>
868<p>
869 Add modified contents in the working tree interactively to
Junio C Hamanoe0facb92007-12-05 10:59:48870 the index. Optional path arguments may be supplied to limit
871 operation to a subset of the working tree. See &#8220;Interactive
872 mode&#8221; for details.
Junio C Hamano17bbaca2006-12-25 11:36:31873</p>
874</dd>
Junio C Hamano97bcb482010-11-25 03:16:07875<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47876-p
877</dt>
Junio C Hamano97bcb482010-11-25 03:16:07878<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47879--patch
Junio C Hamano8d1e4712007-12-11 08:54:21880</dt>
881<dd>
882<p>
Junio C Hamano7df6dcf2009-09-13 09:51:17883 Interactively choose hunks of patch between the index and the
884 work tree and add them to the index. This gives the user a chance
885 to review the difference before adding modified contents to the
886 index.
Junio C Hamano8d1e4712007-12-11 08:54:21887</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53888<div class="paragraph"><p>This effectively runs <code>add --interactive</code>, but bypasses the
889initial command menu and directly jumps to the <code>patch</code> subcommand.
Junio C Hamanoe1b26832009-11-15 10:02:56890See &#8220;Interactive mode&#8221; for details.</p></div>
Junio C Hamano8d1e4712007-12-11 08:54:21891</dd>
Junio C Hamano97bcb482010-11-25 03:16:07892<dt class="hdlist1">
Junio C Hamano1dbca522015-05-22 20:48:55893-e
894</dt>
895<dt class="hdlist1">
896--edit
Junio C Hamano52ba2952009-05-18 17:43:02897</dt>
898<dd>
899<p>
900 Open the diff vs. the index in an editor and let the user
901 edit it. After the editor was closed, adjust the hunk headers
902 and apply the patch to the index.
903</p>
Junio C Hamano97bcb482010-11-25 03:16:07904<div class="paragraph"><p>The intent of this option is to pick and choose lines of the patch to
905apply, or even to modify the contents of lines to be staged. This can be
906quicker and more flexible than using the interactive hunk selector.
907However, it is easy to confuse oneself and create a patch that does not
908apply to the index. See EDITING PATCHES below.</p></div>
Junio C Hamano52ba2952009-05-18 17:43:02909</dd>
Junio C Hamano97bcb482010-11-25 03:16:07910<dt class="hdlist1">
Junio C Hamano3d30fd52007-05-08 00:32:53911-u
912</dt>
Junio C Hamano97bcb482010-11-25 03:16:07913<dt class="hdlist1">
Junio C Hamano00e884a2008-06-15 05:10:38914--update
915</dt>
Junio C Hamano3d30fd52007-05-08 00:32:53916<dd>
917<p>
Junio C Hamanof66c4632013-03-11 20:54:25918 Update the index just where it already has an entry matching
919 &lt;pathspec&gt;. This removes as well as modifies index entries to
920 match the working tree, but adds no new files.
Junio C Hamano3d30fd52007-05-08 00:32:53921</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53922<div class="paragraph"><p>If no &lt;pathspec&gt; is given when <code>-u</code> option is used, all
Junio C Hamano1d669b82014-03-11 21:36:00923tracked files in the entire working tree are updated (old versions
924of Git used to limit the update to the current directory and its
925subdirectories).</p></div>
Junio C Hamano3d30fd52007-05-08 00:32:53926</dd>
Junio C Hamano97bcb482010-11-25 03:16:07927<dt class="hdlist1">
Junio C Hamano5ba2c222008-07-21 04:33:46928-A
929</dt>
Junio C Hamano97bcb482010-11-25 03:16:07930<dt class="hdlist1">
Junio C Hamano5ba2c222008-07-21 04:33:46931--all
932</dt>
Junio C Hamanof26c77e2013-04-27 00:06:04933<dt class="hdlist1">
934--no-ignore-removal
935</dt>
Junio C Hamano5ba2c222008-07-21 04:33:46936<dd>
937<p>
Junio C Hamanof66c4632013-03-11 20:54:25938 Update the index not only where the working tree has a file
939 matching &lt;pathspec&gt; but also where the index already has an
Junio C Hamano2567b322019-02-05 23:33:56940 entry. This adds, modifies, and removes index entries to
Junio C Hamanof66c4632013-03-11 20:54:25941 match the working tree.
Junio C Hamano5ba2c222008-07-21 04:33:46942</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53943<div class="paragraph"><p>If no &lt;pathspec&gt; is given when <code>-A</code> option is used, all
Junio C Hamano1d669b82014-03-11 21:36:00944files in the entire working tree are updated (old versions
945of Git used to limit the update to the current directory and its
946subdirectories).</p></div>
Junio C Hamano5ba2c222008-07-21 04:33:46947</dd>
Junio C Hamano97bcb482010-11-25 03:16:07948<dt class="hdlist1">
Junio C Hamanoc79bc672013-04-22 19:12:47949--no-all
950</dt>
Junio C Hamanof26c77e2013-04-27 00:06:04951<dt class="hdlist1">
952--ignore-removal
953</dt>
Junio C Hamanoc79bc672013-04-22 19:12:47954<dd>
955<p>
956 Update the index by adding new files that are unknown to the
957 index and files modified in the working tree, but ignore
958 files that have been removed from the working tree. This
959 option is a no-op when no &lt;pathspec&gt; is used.
960</p>
Junio C Hamano1d669b82014-03-11 21:36:00961<div class="paragraph"><p>This option is primarily to help users who are used to older
962versions of Git, whose "git add &lt;pathspec&gt;&#8230;" was a synonym
963for "git add --no-all &lt;pathspec&gt;&#8230;", i.e. ignored removed files.</p></div>
Junio C Hamanoc79bc672013-04-22 19:12:47964</dd>
965<dt class="hdlist1">
Junio C Hamano845880c2008-10-21 19:04:45966-N
967</dt>
Junio C Hamano97bcb482010-11-25 03:16:07968<dt class="hdlist1">
Junio C Hamano845880c2008-10-21 19:04:45969--intent-to-add
970</dt>
971<dd>
972<p>
973 Record only the fact that the path will be added later. An entry
974 for the path is placed in the index with no content. This is
975 useful for, among other things, showing the unstaged content of
Junio C Hamanoc14e6ad2014-10-31 20:25:53976 such files with <code>git diff</code> and committing them with <code>git commit
977 -a</code>.
Junio C Hamano845880c2008-10-21 19:04:45978</p>
979</dd>
Junio C Hamano97bcb482010-11-25 03:16:07980<dt class="hdlist1">
Junio C Hamano024b6c62007-08-14 09:43:08981--refresh
982</dt>
983<dd>
984<p>
Junio C Hamano97bcb482010-11-25 03:16:07985 Don&#8217;t add the file(s), but only refresh their stat()
Junio C Hamano024b6c62007-08-14 09:43:08986 information in the index.
987</p>
988</dd>
Junio C Hamano97bcb482010-11-25 03:16:07989<dt class="hdlist1">
Junio C Hamanofeeb1be2008-05-22 00:53:35990--ignore-errors
991</dt>
992<dd>
993<p>
994 If some files could not be added because of errors indexing
995 them, do not abort the operation, but continue adding the
996 others. The command shall still exit with non-zero status.
Junio C Hamanoc14e6ad2014-10-31 20:25:53997 The configuration variable <code>add.ignoreErrors</code> can be set to
Junio C Hamanob77f8192011-05-05 01:30:38998 true to make this the default behaviour.
Junio C Hamanofeeb1be2008-05-22 00:53:35999</p>
1000</dd>
Junio C Hamano97bcb482010-11-25 03:16:071001<dt class="hdlist1">
Junio C Hamanoafabd322010-07-19 20:26:151002--ignore-missing
1003</dt>
1004<dd>
1005<p>
1006 This option can only be used together with --dry-run. By using
1007 this option the user can check if any of the given files would
1008 be ignored, no matter if they are already present in the work
1009 tree or not.
1010</p>
1011</dd>
Junio C Hamano97bcb482010-11-25 03:16:071012<dt class="hdlist1">
Junio C Hamano535c65c2017-06-24 22:51:581013--no-warn-embedded-repo
1014</dt>
1015<dd>
1016<p>
1017 By default, <code>git add</code> will warn when adding an embedded
1018 repository to the index without using <code>git submodule add</code> to
1019 create an entry in <code>.gitmodules</code>. This option will suppress the
1020 warning (e.g., if you are manually performing operations on
1021 submodules).
1022</p>
1023</dd>
1024<dt class="hdlist1">
Junio C Hamano4886c772017-11-27 03:33:281025--renormalize
1026</dt>
1027<dd>
1028<p>
1029 Apply the "clean" process freshly to all tracked files to
1030 forcibly add them again to the index. This is useful after
1031 changing <code>core.autocrlf</code> configuration or the <code>text</code> attribute
1032 in order to correct files added with wrong CRLF/LF line endings.
Junio C Hamano04495a12022-08-18 21:13:081033 This option implies <code>-u</code>. Lone CR characters are untouched, thus
1034 while a CRLF cleans to LF, a CRCRLF sequence is only partially
1035 cleaned to CRLF.
Junio C Hamano4886c772017-11-27 03:33:281036</p>
1037</dd>
1038<dt class="hdlist1">
Junio C Hamano53800482016-09-21 23:26:431039--chmod=(+|-)x
1040</dt>
1041<dd>
1042<p>
1043 Override the executable bit of the added files. The executable
1044 bit is only changed in the index, the files on disk are left
1045 unchanged.
1046</p>
1047</dd>
1048<dt class="hdlist1">
Junio C Hamano2f5a9892019-12-25 21:12:551049--pathspec-from-file=&lt;file&gt;
1050</dt>
1051<dd>
1052<p>
1053 Pathspec is passed in <code>&lt;file&gt;</code> instead of commandline args. If
1054 <code>&lt;file&gt;</code> is exactly <code>-</code> then standard input is used. Pathspec
1055 elements are separated by LF or CR/LF. Pathspec elements can be
1056 quoted as explained for the configuration variable <code>core.quotePath</code>
1057 (see <a href="git-config.html">git-config(1)</a>). See also <code>--pathspec-file-nul</code> and
1058 global <code>--literal-pathspecs</code>.
1059</p>
1060</dd>
1061<dt class="hdlist1">
1062--pathspec-file-nul
1063</dt>
1064<dd>
1065<p>
1066 Only meaningful with <code>--pathspec-from-file</code>. Pathspec elements are
1067 separated with NUL character and all other characters are taken
1068 literally (including newlines and quotes).
1069</p>
1070</dd>
1071<dt class="hdlist1">
Junio C Hamano1bb569e2006-05-05 23:14:251072--
Junio C Hamano7e9f6b72006-02-22 10:44:551073</dt>
1074<dd>
1075<p>
1076 This option can be used to separate command-line options from
1077 the list of files, (useful when filenames might be mistaken
1078 for command-line options).
1079</p>
1080</dd>
Junio C Hamano46a38aa2008-07-14 03:13:271081</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:231082</div>
Junio C Hamano9d971152012-12-19 00:43:111083</div>
1084<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:271085<h2 id="_examples">EXAMPLES</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231086<div class="sectionbody">
Junio C Hamano97bcb482010-11-25 03:16:071087<div class="ulist"><ul>
Junio C Hamano6d76d612008-05-09 05:46:081088<li>
Junio C Hamano1a4e8412005-12-27 08:17:231089<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531090Adds content from all <code>*.txt</code> files under <code>Documentation</code> directory
Junio C Hamano2567b322019-02-05 23:33:561091 and its subdirectories:
Junio C Hamano1a4e8412005-12-27 08:17:231092</p>
Junio C Hamano6d76d612008-05-09 05:46:081093<div class="listingblock">
1094<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531095<pre><code>$ git add Documentation/\*.txt</code></pre>
Junio C Hamano6d76d612008-05-09 05:46:081096</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531097<div class="paragraph"><p>Note that the asterisk <code>*</code> is quoted from the shell in this
Junio C Hamanof8a79222009-03-01 08:02:501098example; this lets the command include the files from
Junio C Hamanoc14e6ad2014-10-31 20:25:531099subdirectories of <code>Documentation/</code> directory.</p></div>
Junio C Hamano6d76d612008-05-09 05:46:081100</li>
1101<li>
Junio C Hamano1a4e8412005-12-27 08:17:231102<p>
Junio C Hamano6d76d612008-05-09 05:46:081103Considers adding content from all git-*.sh scripts:
Junio C Hamano1a4e8412005-12-27 08:17:231104</p>
Junio C Hamano6d76d612008-05-09 05:46:081105<div class="listingblock">
1106<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531107<pre><code>$ git add git-*.sh</code></pre>
Junio C Hamano6d76d612008-05-09 05:46:081108</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071109<div class="paragraph"><p>Because this example lets the shell expand the asterisk (i.e. you are
Junio C Hamano6d76d612008-05-09 05:46:081110listing the files explicitly), it does not consider
Junio C Hamanoc14e6ad2014-10-31 20:25:531111<code>subdir/git-foo.sh</code>.</p></div>
Junio C Hamano6d76d612008-05-09 05:46:081112</li>
Junio C Hamano46a38aa2008-07-14 03:13:271113</ul></div>
Junio C Hamano1a4e8412005-12-27 08:17:231114</div>
Junio C Hamano9d971152012-12-19 00:43:111115</div>
1116<div class="sect1">
Junio C Hamanob9d9d902018-05-23 07:07:421117<h2 id="_interactive_mode">INTERACTIVE MODE</h2>
Junio C Hamano17bbaca2006-12-25 11:36:311118<div class="sectionbody">
Junio C Hamano97bcb482010-11-25 03:16:071119<div class="paragraph"><p>When the command enters the interactive mode, it shows the
Junio C Hamanof9771f62007-01-17 17:42:301120output of the <em>status</em> subcommand, and then goes into its
Junio C Hamano46a38aa2008-07-14 03:13:271121interactive command loop.</p></div>
Junio C Hamano97bcb482010-11-25 03:16:071122<div class="paragraph"><p>The command loop shows the list of subcommands available, and
Junio C Hamano17bbaca2006-12-25 11:36:311123gives a prompt "What now&gt; ". In general, when the prompt ends
1124with a single <em>&gt;</em>, you can pick only one of the choices given
Junio C Hamano46a38aa2008-07-14 03:13:271125and type return, like this:</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311126<div class="listingblock">
1127<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531128<pre><code> *** Commands ***
Junio C Hamano17bbaca2006-12-25 11:36:311129 1: status 2: update 3: revert 4: add untracked
1130 5: patch 6: diff 7: quit 8: help
Junio C Hamanoc14e6ad2014-10-31 20:25:531131 What now&gt; 1</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311132</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531133<div class="paragraph"><p>You also could say <code>s</code> or <code>sta</code> or <code>status</code> above as long as the
Junio C Hamano46a38aa2008-07-14 03:13:271134choice is unique.</p></div>
Junio C Hamano97bcb482010-11-25 03:16:071135<div class="paragraph"><p>The main command loop has 6 subcommands (plus help and quit).</p></div>
1136<div class="dlist"><dl>
1137<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311138status
1139</dt>
1140<dd>
1141<p>
1142 This shows the change between HEAD and index (i.e. what will be
Junio C Hamanoc14e6ad2014-10-31 20:25:531143 committed if you say <code>git commit</code>), and between index and
Junio C Hamano17bbaca2006-12-25 11:36:311144 working tree files (i.e. what you could stage further before
Junio C Hamanoc14e6ad2014-10-31 20:25:531145 <code>git commit</code> using <code>git add</code>) for each path. A sample output
Junio C Hamano17bbaca2006-12-25 11:36:311146 looks like this:
1147</p>
1148<div class="listingblock">
1149<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531150<pre><code> staged unstaged path
Junio C Hamano17bbaca2006-12-25 11:36:311151 1: binary nothing foo.png
Junio C Hamano3583c5c2023-02-22 23:31:591152 2: +403/-35 +1/-1 add-interactive.c</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311153</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071154<div class="paragraph"><p>It shows that foo.png has differences from HEAD (but that is
Junio C Hamano17bbaca2006-12-25 11:36:311155binary so line count cannot be shown) and there is no
1156difference between indexed copy and the working tree
1157version (if the working tree version were also different,
1158<em>binary</em> would have been shown in place of <em>nothing</em>). The
Junio C Hamano3583c5c2023-02-22 23:31:591159other file, add-interactive.c, has 403 lines added
Junio C Hamano17bbaca2006-12-25 11:36:311160and 35 lines deleted if you commit what is in the index, but
1161working tree file has further modifications (one addition and
Junio C Hamano46a38aa2008-07-14 03:13:271162one deletion).</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311163</dd>
Junio C Hamano97bcb482010-11-25 03:16:071164<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311165update
1166</dt>
1167<dd>
1168<p>
Junio C Hamanof8a79222009-03-01 08:02:501169 This shows the status information and issues an "Update&gt;&gt;"
1170 prompt. When the prompt ends with double <em>&gt;&gt;</em>, you can
Junio C Hamano17bbaca2006-12-25 11:36:311171 make more than one selection, concatenated with whitespace or
1172 comma. Also you can say ranges. E.g. "2-5 7,9" to choose
Junio C Hamano38ddcce2008-07-15 15:49:031173 2,3,4,5,7,9 from the list. If the second number in a range is
1174 omitted, all remaining patches are taken. E.g. "7-" to choose
1175 7,8,9 from the list. You can say <em>*</em> to choose everything.
Junio C Hamano17bbaca2006-12-25 11:36:311176</p>
Junio C Hamano97bcb482010-11-25 03:16:071177<div class="paragraph"><p>What you chose are then highlighted with <em>*</em>,
Junio C Hamano46a38aa2008-07-14 03:13:271178like this:</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311179<div class="listingblock">
1180<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531181<pre><code> staged unstaged path
Junio C Hamano17bbaca2006-12-25 11:36:311182 1: binary nothing foo.png
Junio C Hamano3583c5c2023-02-22 23:31:591183* 2: +403/-35 +1/-1 add-interactive.c</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311184</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531185<div class="paragraph"><p>To remove selection, prefix the input with <code>-</code>
Junio C Hamano46a38aa2008-07-14 03:13:271186like this:</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311187<div class="listingblock">
1188<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531189<pre><code>Update&gt;&gt; -2</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311190</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071191<div class="paragraph"><p>After making the selection, answer with an empty line to stage the
Junio C Hamano46a38aa2008-07-14 03:13:271192contents of working tree files for selected paths in the index.</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311193</dd>
Junio C Hamano97bcb482010-11-25 03:16:071194<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311195revert
1196</dt>
1197<dd>
1198<p>
1199 This has a very similar UI to <em>update</em>, and the staged
1200 information for selected paths are reverted to that of the
1201 HEAD version. Reverting new paths makes them untracked.
1202</p>
1203</dd>
Junio C Hamano97bcb482010-11-25 03:16:071204<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311205add untracked
1206</dt>
1207<dd>
1208<p>
1209 This has a very similar UI to <em>update</em> and
1210 <em>revert</em>, and lets you add untracked paths to the index.
1211</p>
1212</dd>
Junio C Hamano97bcb482010-11-25 03:16:071213<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311214patch
1215</dt>
1216<dd>
1217<p>
Junio C Hamanof8a79222009-03-01 08:02:501218 This lets you choose one path out of a <em>status</em> like selection.
1219 After choosing the path, it presents the diff between the index
Junio C Hamano17bbaca2006-12-25 11:36:311220 and the working tree file and asks you if you want to stage
Junio C Hamano9eb58352011-05-11 20:09:241221 the change of each hunk. You can select one of the following
1222 options and type return:
Junio C Hamano17bbaca2006-12-25 11:36:311223</p>
1224<div class="literalblock">
1225<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531226<pre><code>y - stage this hunk
Junio C Hamano8760ea62008-03-14 08:58:451227n - do not stage this hunk
Junio C Hamanod75148a2014-04-08 19:48:381228q - quit; do not stage this hunk or any of the remaining ones
Junio C Hamanoa574a092010-06-13 19:57:101229a - stage this hunk and all later hunks in the file
Junio C Hamanod75148a2014-04-08 19:48:381230d - do not stage this hunk or any of the later hunks in the file
Junio C Hamano3bd66e92009-04-18 06:17:561231g - select a hunk to go to
1232/ - search for a hunk matching the given regex
Junio C Hamano8760ea62008-03-14 08:58:451233j - leave this hunk undecided, see next undecided hunk
1234J - leave this hunk undecided, see next hunk
1235k - leave this hunk undecided, see previous undecided hunk
1236K - leave this hunk undecided, see previous hunk
Junio C Hamanoe0facb92007-12-05 10:59:481237s - split the current hunk into smaller hunks
Junio C Hamano46a38aa2008-07-14 03:13:271238e - manually edit the current hunk
Junio C Hamanoc14e6ad2014-10-31 20:25:531239? - print help</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311240</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071241<div class="paragraph"><p>After deciding the fate for all hunks, if there is any hunk
Junio C Hamano46a38aa2008-07-14 03:13:271242that was chosen, the index is updated with the selected hunks.</p></div>
Junio C Hamano9eb58352011-05-11 20:09:241243<div class="paragraph"><p>You can omit having to type return here, by setting the configuration
Junio C Hamano322c6242015-03-23 21:32:461244variable <code>interactive.singleKey</code> to <code>true</code>.</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311245</dd>
Junio C Hamano97bcb482010-11-25 03:16:071246<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311247diff
1248</dt>
1249<dd>
1250<p>
1251 This lets you review what will be committed (i.e. between
1252 HEAD and index).
1253</p>
1254</dd>
Junio C Hamano46a38aa2008-07-14 03:13:271255</dl></div>
Junio C Hamano17bbaca2006-12-25 11:36:311256</div>
Junio C Hamano9d971152012-12-19 00:43:111257</div>
1258<div class="sect1">
Junio C Hamano97bcb482010-11-25 03:16:071259<h2 id="_editing_patches">EDITING PATCHES</h2>
1260<div class="sectionbody">
Junio C Hamanoc14e6ad2014-10-31 20:25:531261<div class="paragraph"><p>Invoking <code>git add -e</code> or selecting <code>e</code> from the interactive hunk
Junio C Hamano97bcb482010-11-25 03:16:071262selector will open a patch in your editor; after the editor exits, the
1263result is applied to the index. You are free to make arbitrary changes
1264to the patch, but note that some changes may have confusing results, or
1265even result in a patch that cannot be applied. If you want to abort the
1266operation entirely (i.e., stage nothing new in the index), simply delete
1267all lines of the patch. The list below describes some common things you
1268may see in a patch, and which editing operations make sense on them.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111269<div class="openblock">
1270<div class="content">
Junio C Hamano97bcb482010-11-25 03:16:071271<div class="dlist"><dl>
1272<dt class="hdlist1">
1273added content
1274</dt>
1275<dd>
1276<p>
1277Added content is represented by lines beginning with "&#43;". You can
1278prevent staging any addition lines by deleting them.
1279</p>
1280</dd>
1281<dt class="hdlist1">
1282removed content
1283</dt>
1284<dd>
1285<p>
1286Removed content is represented by lines beginning with "-". You can
1287prevent staging their removal by converting the "-" to a " " (space).
1288</p>
1289</dd>
1290<dt class="hdlist1">
1291modified content
1292</dt>
1293<dd>
1294<p>
1295Modified content is represented by "-" lines (removing the old content)
1296followed by "&#43;" lines (adding the replacement content). You can
1297prevent staging the modification by converting "-" lines to " ", and
1298removing "&#43;" lines. Beware that modifying only half of the pair is
1299likely to introduce confusing changes to the index.
1300</p>
1301</dd>
1302</dl></div>
Junio C Hamano9d971152012-12-19 00:43:111303</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071304<div class="paragraph"><p>There are also more complex operations that can be performed. But beware
1305that because the patch is applied only to the index and not the working
1306tree, the working tree will appear to "undo" the change in the index.
Junio C Hamano7165bf72011-01-04 22:06:181307For example, introducing a new line into the index that is in neither
Junio C Hamano97bcb482010-11-25 03:16:071308the HEAD nor the working tree will stage the new line for commit, but
1309the line will appear to be reverted in the working tree.</p></div>
1310<div class="paragraph"><p>Avoid using these constructs, or do so with extreme caution.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111311<div class="openblock">
1312<div class="content">
Junio C Hamano97bcb482010-11-25 03:16:071313<div class="dlist"><dl>
1314<dt class="hdlist1">
1315removing untouched content
1316</dt>
1317<dd>
1318<p>
1319Content which does not differ between the index and working tree may be
1320shown on context lines, beginning with a " " (space). You can stage
1321context lines for removal by converting the space to a "-". The
1322resulting working tree file will appear to re-add the content.
1323</p>
1324</dd>
1325<dt class="hdlist1">
1326modifying existing content
1327</dt>
1328<dd>
1329<p>
1330One can also modify context lines by staging them for removal (by
1331converting " " to "-") and adding a "&#43;" line with the new content.
1332Similarly, one can modify "&#43;" lines for existing additions or
1333modifications. In all cases, the new modification will appear reverted
1334in the working tree.
1335</p>
1336</dd>
1337<dt class="hdlist1">
1338new content
1339</dt>
1340<dd>
1341<p>
1342You may also add new content that does not exist in the patch; simply
1343add new lines, each starting with "&#43;". The addition will appear
1344reverted in the working tree.
1345</p>
1346</dd>
1347</dl></div>
Junio C Hamano9d971152012-12-19 00:43:111348</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071349<div class="paragraph"><p>There are also several operations which should be avoided entirely, as
1350they will make the patch impossible to apply:</p></div>
1351<div class="ulist"><ul>
1352<li>
1353<p>
1354adding context (" ") or removal ("-") lines
1355</p>
1356</li>
1357<li>
1358<p>
1359deleting context or removal lines
1360</p>
1361</li>
1362<li>
1363<p>
1364modifying the contents of context or removal lines
1365</p>
1366</li>
1367</ul></div>
1368</div>
Junio C Hamano9d971152012-12-19 00:43:111369</div>
1370<div class="sect1">
Junio C Hamanoba8baee2022-09-14 20:25:231371<h2 id="_configuration">CONFIGURATION</h2>
1372<div class="sectionbody">
1373<div class="paragraph"><p>Everything below this line in this section is selectively included
1374from the <a href="git-config.html">git-config(1)</a> documentation. The content is the same
1375as what&#8217;s found there:</p></div>
1376<div class="dlist"><dl>
1377<dt class="hdlist1">
1378add.ignoreErrors
1379</dt>
1380<dt class="hdlist1">
1381add.ignore-errors (deprecated)
1382</dt>
1383<dd>
1384<p>
1385 Tells <em>git add</em> to continue adding files when some files cannot be
1386 added due to indexing errors. Equivalent to the <code>--ignore-errors</code>
1387 option of <a href="git-add.html">git-add(1)</a>. <code>add.ignore-errors</code> is deprecated,
1388 as it does not follow the usual naming convention for configuration
1389 variables.
1390</p>
1391</dd>
1392<dt class="hdlist1">
1393add.interactive.useBuiltin
1394</dt>
1395<dd>
1396<p>
Junio C Hamano3583c5c2023-02-22 23:31:591397 Unused configuration variable. Used in Git versions v2.25.0 to
1398 v2.36.0 to enable the built-in version of <a href="git-add.html">git-add(1)</a>'s
1399 interactive mode, which then became the default in Git
1400 versions v2.37.0 to v2.39.0.
Junio C Hamanoba8baee2022-09-14 20:25:231401</p>
1402</dd>
1403</dl></div>
1404</div>
1405</div>
1406<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:271407<h2 id="_see_also">SEE ALSO</h2>
Junio C Hamano2bb13102006-03-06 07:10:211408<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:231409<div class="paragraph"><p><a href="git-status.html">git-status(1)</a>
1410<a href="git-rm.html">git-rm(1)</a>
1411<a href="git-reset.html">git-reset(1)</a>
1412<a href="git-mv.html">git-mv(1)</a>
1413<a href="git-commit.html">git-commit(1)</a>
1414<a href="git-update-index.html">git-update-index(1)</a></p></div>
Junio C Hamano2bb13102006-03-06 07:10:211415</div>
Junio C Hamano9d971152012-12-19 00:43:111416</div>
1417<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:271418<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231419<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:231420<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231421</div>
Junio C Hamano7bd050f2011-09-22 06:32:221422</div>
Junio C Hamano9d971152012-12-19 00:43:111423</div>
Junio C Hamano7bd050f2011-09-22 06:32:221424<div id="footnotes"><hr /></div>
Junio C Hamano1a4e8412005-12-27 08:17:231425<div id="footer">
1426<div id="footer-text">
Junio C Hamano2ef0ba32018-01-26 23:13:531427Last updated
Junio C Hamanoa7b2c102023-06-13 21:00:151428 2023-02-22 15:29:29 PST
Junio C Hamano1a4e8412005-12-27 08:17:231429</div>
1430</div>
1431</body>
1432</html>