blob: 21537c490a253585f4763c4ee8d5076cad68e950 [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 Hamanob9d9d902018-05-23 07:07:427<meta name="generator" content="AsciiDoc 8.6.10" />
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 Hamano7bd050f2011-09-22 06:32:22542var 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;
Junio C Hamanoc14e6ad2014-10-31 20:25:53583 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
Junio C Hamano7bd050f2011-09-22 06:32:22584 // 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");
Junio C Hamano9d971152012-12-19 00:43:11603 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];
Junio C Hamanoc14e6ad2014-10-31 20:25:53612 if (entry.nodeName.toLowerCase() == 'div'
Junio C Hamano9d971152012-12-19 00:43:11613 && 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.
Junio C Hamano7bd050f2011-09-22 06:32:22622 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 () {
Junio C Hamano9d971152012-12-19 00:43:11649 // Delete existing footnote entries in case we're reloading the footnodes.
650 var i;
Junio C Hamano7bd050f2011-09-22 06:32:22651 var noteholder = document.getElementById("footnotes");
Junio C Hamano9d971152012-12-19 00:43:11652 if (!noteholder) {
653 return;
654 }
655 var entriesToRemove = [];
656 for (i = 0; i < noteholder.childNodes.length; i++) {
657 var entry = noteholder.childNodes[i];
Junio C Hamanoc14e6ad2014-10-31 20:25:53658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
Junio C Hamano9d971152012-12-19 00:43:11659 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");
Junio C Hamano7bd050f2011-09-22 06:32:22667 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++;
Junio C Hamano9d971152012-12-19 00:43:11673 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 }
Junio C Hamano7bd050f2011-09-22 06:32:22683 noteholder.innerHTML +=
684 "<div class='footnote' id='_footnote_" + n + "'>" +
685 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
686 n + "</a>. " + note + "</div>";
Junio C Hamano7bd050f2011-09-22 06:32:22687 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 }
Junio C Hamano9d971152012-12-19 00:43:11706},
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;
Junio C Hamano7bd050f2011-09-22 06:32:22728}
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 Hamanof26c77e2013-04-27 00:06:04753 [--edit | -e] [--[no-]all | --[no-]ignore-removal | [--update | -u]]
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 Hamanoeb415992008-06-08 22:49:47850-i
851</dt>
Junio C Hamano97bcb482010-11-25 03:16:07852<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47853--interactive
Junio C Hamano17bbaca2006-12-25 11:36:31854</dt>
855<dd>
856<p>
857 Add modified contents in the working tree interactively to
Junio C Hamanoe0facb92007-12-05 10:59:48858 the index. Optional path arguments may be supplied to limit
859 operation to a subset of the working tree. See &#8220;Interactive
860 mode&#8221; for details.
Junio C Hamano17bbaca2006-12-25 11:36:31861</p>
862</dd>
Junio C Hamano97bcb482010-11-25 03:16:07863<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47864-p
865</dt>
Junio C Hamano97bcb482010-11-25 03:16:07866<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47867--patch
Junio C Hamano8d1e4712007-12-11 08:54:21868</dt>
869<dd>
870<p>
Junio C Hamano7df6dcf2009-09-13 09:51:17871 Interactively choose hunks of patch between the index and the
872 work tree and add them to the index. This gives the user a chance
873 to review the difference before adding modified contents to the
874 index.
Junio C Hamano8d1e4712007-12-11 08:54:21875</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53876<div class="paragraph"><p>This effectively runs <code>add --interactive</code>, but bypasses the
877initial command menu and directly jumps to the <code>patch</code> subcommand.
Junio C Hamanoe1b26832009-11-15 10:02:56878See &#8220;Interactive mode&#8221; for details.</p></div>
Junio C Hamano8d1e4712007-12-11 08:54:21879</dd>
Junio C Hamano97bcb482010-11-25 03:16:07880<dt class="hdlist1">
Junio C Hamano1dbca522015-05-22 20:48:55881-e
882</dt>
883<dt class="hdlist1">
884--edit
Junio C Hamano52ba2952009-05-18 17:43:02885</dt>
886<dd>
887<p>
888 Open the diff vs. the index in an editor and let the user
889 edit it. After the editor was closed, adjust the hunk headers
890 and apply the patch to the index.
891</p>
Junio C Hamano97bcb482010-11-25 03:16:07892<div class="paragraph"><p>The intent of this option is to pick and choose lines of the patch to
893apply, or even to modify the contents of lines to be staged. This can be
894quicker and more flexible than using the interactive hunk selector.
895However, it is easy to confuse oneself and create a patch that does not
896apply to the index. See EDITING PATCHES below.</p></div>
Junio C Hamano52ba2952009-05-18 17:43:02897</dd>
Junio C Hamano97bcb482010-11-25 03:16:07898<dt class="hdlist1">
Junio C Hamano3d30fd52007-05-08 00:32:53899-u
900</dt>
Junio C Hamano97bcb482010-11-25 03:16:07901<dt class="hdlist1">
Junio C Hamano00e884a2008-06-15 05:10:38902--update
903</dt>
Junio C Hamano3d30fd52007-05-08 00:32:53904<dd>
905<p>
Junio C Hamanof66c4632013-03-11 20:54:25906 Update the index just where it already has an entry matching
907 &lt;pathspec&gt;. This removes as well as modifies index entries to
908 match the working tree, but adds no new files.
Junio C Hamano3d30fd52007-05-08 00:32:53909</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53910<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:00911tracked files in the entire working tree are updated (old versions
912of Git used to limit the update to the current directory and its
913subdirectories).</p></div>
Junio C Hamano3d30fd52007-05-08 00:32:53914</dd>
Junio C Hamano97bcb482010-11-25 03:16:07915<dt class="hdlist1">
Junio C Hamano5ba2c222008-07-21 04:33:46916-A
917</dt>
Junio C Hamano97bcb482010-11-25 03:16:07918<dt class="hdlist1">
Junio C Hamano5ba2c222008-07-21 04:33:46919--all
920</dt>
Junio C Hamanof26c77e2013-04-27 00:06:04921<dt class="hdlist1">
922--no-ignore-removal
923</dt>
Junio C Hamano5ba2c222008-07-21 04:33:46924<dd>
925<p>
Junio C Hamanof66c4632013-03-11 20:54:25926 Update the index not only where the working tree has a file
927 matching &lt;pathspec&gt; but also where the index already has an
Junio C Hamano2567b322019-02-05 23:33:56928 entry. This adds, modifies, and removes index entries to
Junio C Hamanof66c4632013-03-11 20:54:25929 match the working tree.
Junio C Hamano5ba2c222008-07-21 04:33:46930</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53931<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:00932files in the entire working tree are updated (old versions
933of Git used to limit the update to the current directory and its
934subdirectories).</p></div>
Junio C Hamano5ba2c222008-07-21 04:33:46935</dd>
Junio C Hamano97bcb482010-11-25 03:16:07936<dt class="hdlist1">
Junio C Hamanoc79bc672013-04-22 19:12:47937--no-all
938</dt>
Junio C Hamanof26c77e2013-04-27 00:06:04939<dt class="hdlist1">
940--ignore-removal
941</dt>
Junio C Hamanoc79bc672013-04-22 19:12:47942<dd>
943<p>
944 Update the index by adding new files that are unknown to the
945 index and files modified in the working tree, but ignore
946 files that have been removed from the working tree. This
947 option is a no-op when no &lt;pathspec&gt; is used.
948</p>
Junio C Hamano1d669b82014-03-11 21:36:00949<div class="paragraph"><p>This option is primarily to help users who are used to older
950versions of Git, whose "git add &lt;pathspec&gt;&#8230;" was a synonym
951for "git add --no-all &lt;pathspec&gt;&#8230;", i.e. ignored removed files.</p></div>
Junio C Hamanoc79bc672013-04-22 19:12:47952</dd>
953<dt class="hdlist1">
Junio C Hamano845880c2008-10-21 19:04:45954-N
955</dt>
Junio C Hamano97bcb482010-11-25 03:16:07956<dt class="hdlist1">
Junio C Hamano845880c2008-10-21 19:04:45957--intent-to-add
958</dt>
959<dd>
960<p>
961 Record only the fact that the path will be added later. An entry
962 for the path is placed in the index with no content. This is
963 useful for, among other things, showing the unstaged content of
Junio C Hamanoc14e6ad2014-10-31 20:25:53964 such files with <code>git diff</code> and committing them with <code>git commit
965 -a</code>.
Junio C Hamano845880c2008-10-21 19:04:45966</p>
967</dd>
Junio C Hamano97bcb482010-11-25 03:16:07968<dt class="hdlist1">
Junio C Hamano024b6c62007-08-14 09:43:08969--refresh
970</dt>
971<dd>
972<p>
Junio C Hamano97bcb482010-11-25 03:16:07973 Don&#8217;t add the file(s), but only refresh their stat()
Junio C Hamano024b6c62007-08-14 09:43:08974 information in the index.
975</p>
976</dd>
Junio C Hamano97bcb482010-11-25 03:16:07977<dt class="hdlist1">
Junio C Hamanofeeb1be2008-05-22 00:53:35978--ignore-errors
979</dt>
980<dd>
981<p>
982 If some files could not be added because of errors indexing
983 them, do not abort the operation, but continue adding the
984 others. The command shall still exit with non-zero status.
Junio C Hamanoc14e6ad2014-10-31 20:25:53985 The configuration variable <code>add.ignoreErrors</code> can be set to
Junio C Hamanob77f8192011-05-05 01:30:38986 true to make this the default behaviour.
Junio C Hamanofeeb1be2008-05-22 00:53:35987</p>
988</dd>
Junio C Hamano97bcb482010-11-25 03:16:07989<dt class="hdlist1">
Junio C Hamanoafabd322010-07-19 20:26:15990--ignore-missing
991</dt>
992<dd>
993<p>
994 This option can only be used together with --dry-run. By using
995 this option the user can check if any of the given files would
996 be ignored, no matter if they are already present in the work
997 tree or not.
998</p>
999</dd>
Junio C Hamano97bcb482010-11-25 03:16:071000<dt class="hdlist1">
Junio C Hamano535c65c2017-06-24 22:51:581001--no-warn-embedded-repo
1002</dt>
1003<dd>
1004<p>
1005 By default, <code>git add</code> will warn when adding an embedded
1006 repository to the index without using <code>git submodule add</code> to
1007 create an entry in <code>.gitmodules</code>. This option will suppress the
1008 warning (e.g., if you are manually performing operations on
1009 submodules).
1010</p>
1011</dd>
1012<dt class="hdlist1">
Junio C Hamano4886c772017-11-27 03:33:281013--renormalize
1014</dt>
1015<dd>
1016<p>
1017 Apply the "clean" process freshly to all tracked files to
1018 forcibly add them again to the index. This is useful after
1019 changing <code>core.autocrlf</code> configuration or the <code>text</code> attribute
1020 in order to correct files added with wrong CRLF/LF line endings.
1021 This option implies <code>-u</code>.
1022</p>
1023</dd>
1024<dt class="hdlist1">
Junio C Hamano53800482016-09-21 23:26:431025--chmod=(+|-)x
1026</dt>
1027<dd>
1028<p>
1029 Override the executable bit of the added files. The executable
1030 bit is only changed in the index, the files on disk are left
1031 unchanged.
1032</p>
1033</dd>
1034<dt class="hdlist1">
Junio C Hamano2f5a9892019-12-25 21:12:551035--pathspec-from-file=&lt;file&gt;
1036</dt>
1037<dd>
1038<p>
1039 Pathspec is passed in <code>&lt;file&gt;</code> instead of commandline args. If
1040 <code>&lt;file&gt;</code> is exactly <code>-</code> then standard input is used. Pathspec
1041 elements are separated by LF or CR/LF. Pathspec elements can be
1042 quoted as explained for the configuration variable <code>core.quotePath</code>
1043 (see <a href="git-config.html">git-config(1)</a>). See also <code>--pathspec-file-nul</code> and
1044 global <code>--literal-pathspecs</code>.
1045</p>
1046</dd>
1047<dt class="hdlist1">
1048--pathspec-file-nul
1049</dt>
1050<dd>
1051<p>
1052 Only meaningful with <code>--pathspec-from-file</code>. Pathspec elements are
1053 separated with NUL character and all other characters are taken
1054 literally (including newlines and quotes).
1055</p>
1056</dd>
1057<dt class="hdlist1">
Junio C Hamano1bb569e2006-05-05 23:14:251058--
Junio C Hamano7e9f6b72006-02-22 10:44:551059</dt>
1060<dd>
1061<p>
1062 This option can be used to separate command-line options from
1063 the list of files, (useful when filenames might be mistaken
1064 for command-line options).
1065</p>
1066</dd>
Junio C Hamano46a38aa2008-07-14 03:13:271067</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:231068</div>
Junio C Hamano9d971152012-12-19 00:43:111069</div>
1070<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:271071<h2 id="_examples">EXAMPLES</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231072<div class="sectionbody">
Junio C Hamano97bcb482010-11-25 03:16:071073<div class="ulist"><ul>
Junio C Hamano6d76d612008-05-09 05:46:081074<li>
Junio C Hamano1a4e8412005-12-27 08:17:231075<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531076Adds content from all <code>*.txt</code> files under <code>Documentation</code> directory
Junio C Hamano2567b322019-02-05 23:33:561077 and its subdirectories:
Junio C Hamano1a4e8412005-12-27 08:17:231078</p>
Junio C Hamano6d76d612008-05-09 05:46:081079<div class="listingblock">
1080<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531081<pre><code>$ git add Documentation/\*.txt</code></pre>
Junio C Hamano6d76d612008-05-09 05:46:081082</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531083<div class="paragraph"><p>Note that the asterisk <code>*</code> is quoted from the shell in this
Junio C Hamanof8a79222009-03-01 08:02:501084example; this lets the command include the files from
Junio C Hamanoc14e6ad2014-10-31 20:25:531085subdirectories of <code>Documentation/</code> directory.</p></div>
Junio C Hamano6d76d612008-05-09 05:46:081086</li>
1087<li>
Junio C Hamano1a4e8412005-12-27 08:17:231088<p>
Junio C Hamano6d76d612008-05-09 05:46:081089Considers adding content from all git-*.sh scripts:
Junio C Hamano1a4e8412005-12-27 08:17:231090</p>
Junio C Hamano6d76d612008-05-09 05:46:081091<div class="listingblock">
1092<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531093<pre><code>$ git add git-*.sh</code></pre>
Junio C Hamano6d76d612008-05-09 05:46:081094</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071095<div class="paragraph"><p>Because this example lets the shell expand the asterisk (i.e. you are
Junio C Hamano6d76d612008-05-09 05:46:081096listing the files explicitly), it does not consider
Junio C Hamanoc14e6ad2014-10-31 20:25:531097<code>subdir/git-foo.sh</code>.</p></div>
Junio C Hamano6d76d612008-05-09 05:46:081098</li>
Junio C Hamano46a38aa2008-07-14 03:13:271099</ul></div>
Junio C Hamano1a4e8412005-12-27 08:17:231100</div>
Junio C Hamano9d971152012-12-19 00:43:111101</div>
1102<div class="sect1">
Junio C Hamanob9d9d902018-05-23 07:07:421103<h2 id="_interactive_mode">INTERACTIVE MODE</h2>
Junio C Hamano17bbaca2006-12-25 11:36:311104<div class="sectionbody">
Junio C Hamano97bcb482010-11-25 03:16:071105<div class="paragraph"><p>When the command enters the interactive mode, it shows the
Junio C Hamanof9771f62007-01-17 17:42:301106output of the <em>status</em> subcommand, and then goes into its
Junio C Hamano46a38aa2008-07-14 03:13:271107interactive command loop.</p></div>
Junio C Hamano97bcb482010-11-25 03:16:071108<div class="paragraph"><p>The command loop shows the list of subcommands available, and
Junio C Hamano17bbaca2006-12-25 11:36:311109gives a prompt "What now&gt; ". In general, when the prompt ends
1110with a single <em>&gt;</em>, you can pick only one of the choices given
Junio C Hamano46a38aa2008-07-14 03:13:271111and type return, like this:</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311112<div class="listingblock">
1113<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531114<pre><code> *** Commands ***
Junio C Hamano17bbaca2006-12-25 11:36:311115 1: status 2: update 3: revert 4: add untracked
1116 5: patch 6: diff 7: quit 8: help
Junio C Hamanoc14e6ad2014-10-31 20:25:531117 What now&gt; 1</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311118</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531119<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:271120choice is unique.</p></div>
Junio C Hamano97bcb482010-11-25 03:16:071121<div class="paragraph"><p>The main command loop has 6 subcommands (plus help and quit).</p></div>
1122<div class="dlist"><dl>
1123<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311124status
1125</dt>
1126<dd>
1127<p>
1128 This shows the change between HEAD and index (i.e. what will be
Junio C Hamanoc14e6ad2014-10-31 20:25:531129 committed if you say <code>git commit</code>), and between index and
Junio C Hamano17bbaca2006-12-25 11:36:311130 working tree files (i.e. what you could stage further before
Junio C Hamanoc14e6ad2014-10-31 20:25:531131 <code>git commit</code> using <code>git add</code>) for each path. A sample output
Junio C Hamano17bbaca2006-12-25 11:36:311132 looks like this:
1133</p>
1134<div class="listingblock">
1135<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531136<pre><code> staged unstaged path
Junio C Hamano17bbaca2006-12-25 11:36:311137 1: binary nothing foo.png
Junio C Hamanoc14e6ad2014-10-31 20:25:531138 2: +403/-35 +1/-1 git-add--interactive.perl</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311139</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071140<div class="paragraph"><p>It shows that foo.png has differences from HEAD (but that is
Junio C Hamano17bbaca2006-12-25 11:36:311141binary so line count cannot be shown) and there is no
1142difference between indexed copy and the working tree
1143version (if the working tree version were also different,
1144<em>binary</em> would have been shown in place of <em>nothing</em>). The
Junio C Hamano2db3e752010-09-03 21:33:061145other file, git-add&#45;&#45;interactive.perl, has 403 lines added
Junio C Hamano17bbaca2006-12-25 11:36:311146and 35 lines deleted if you commit what is in the index, but
1147working tree file has further modifications (one addition and
Junio C Hamano46a38aa2008-07-14 03:13:271148one deletion).</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311149</dd>
Junio C Hamano97bcb482010-11-25 03:16:071150<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311151update
1152</dt>
1153<dd>
1154<p>
Junio C Hamanof8a79222009-03-01 08:02:501155 This shows the status information and issues an "Update&gt;&gt;"
1156 prompt. When the prompt ends with double <em>&gt;&gt;</em>, you can
Junio C Hamano17bbaca2006-12-25 11:36:311157 make more than one selection, concatenated with whitespace or
1158 comma. Also you can say ranges. E.g. "2-5 7,9" to choose
Junio C Hamano38ddcce2008-07-15 15:49:031159 2,3,4,5,7,9 from the list. If the second number in a range is
1160 omitted, all remaining patches are taken. E.g. "7-" to choose
1161 7,8,9 from the list. You can say <em>*</em> to choose everything.
Junio C Hamano17bbaca2006-12-25 11:36:311162</p>
Junio C Hamano97bcb482010-11-25 03:16:071163<div class="paragraph"><p>What you chose are then highlighted with <em>*</em>,
Junio C Hamano46a38aa2008-07-14 03:13:271164like this:</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311165<div class="listingblock">
1166<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531167<pre><code> staged unstaged path
Junio C Hamano17bbaca2006-12-25 11:36:311168 1: binary nothing foo.png
Junio C Hamanoc14e6ad2014-10-31 20:25:531169* 2: +403/-35 +1/-1 git-add--interactive.perl</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311170</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531171<div class="paragraph"><p>To remove selection, prefix the input with <code>-</code>
Junio C Hamano46a38aa2008-07-14 03:13:271172like this:</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311173<div class="listingblock">
1174<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531175<pre><code>Update&gt;&gt; -2</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311176</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071177<div class="paragraph"><p>After making the selection, answer with an empty line to stage the
Junio C Hamano46a38aa2008-07-14 03:13:271178contents of working tree files for selected paths in the index.</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311179</dd>
Junio C Hamano97bcb482010-11-25 03:16:071180<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311181revert
1182</dt>
1183<dd>
1184<p>
1185 This has a very similar UI to <em>update</em>, and the staged
1186 information for selected paths are reverted to that of the
1187 HEAD version. Reverting new paths makes them untracked.
1188</p>
1189</dd>
Junio C Hamano97bcb482010-11-25 03:16:071190<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311191add untracked
1192</dt>
1193<dd>
1194<p>
1195 This has a very similar UI to <em>update</em> and
1196 <em>revert</em>, and lets you add untracked paths to the index.
1197</p>
1198</dd>
Junio C Hamano97bcb482010-11-25 03:16:071199<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311200patch
1201</dt>
1202<dd>
1203<p>
Junio C Hamanof8a79222009-03-01 08:02:501204 This lets you choose one path out of a <em>status</em> like selection.
1205 After choosing the path, it presents the diff between the index
Junio C Hamano17bbaca2006-12-25 11:36:311206 and the working tree file and asks you if you want to stage
Junio C Hamano9eb58352011-05-11 20:09:241207 the change of each hunk. You can select one of the following
1208 options and type return:
Junio C Hamano17bbaca2006-12-25 11:36:311209</p>
1210<div class="literalblock">
1211<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531212<pre><code>y - stage this hunk
Junio C Hamano8760ea62008-03-14 08:58:451213n - do not stage this hunk
Junio C Hamanod75148a2014-04-08 19:48:381214q - quit; do not stage this hunk or any of the remaining ones
Junio C Hamanoa574a092010-06-13 19:57:101215a - stage this hunk and all later hunks in the file
Junio C Hamanod75148a2014-04-08 19:48:381216d - do not stage this hunk or any of the later hunks in the file
Junio C Hamano3bd66e92009-04-18 06:17:561217g - select a hunk to go to
1218/ - search for a hunk matching the given regex
Junio C Hamano8760ea62008-03-14 08:58:451219j - leave this hunk undecided, see next undecided hunk
1220J - leave this hunk undecided, see next hunk
1221k - leave this hunk undecided, see previous undecided hunk
1222K - leave this hunk undecided, see previous hunk
Junio C Hamanoe0facb92007-12-05 10:59:481223s - split the current hunk into smaller hunks
Junio C Hamano46a38aa2008-07-14 03:13:271224e - manually edit the current hunk
Junio C Hamanoc14e6ad2014-10-31 20:25:531225? - print help</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311226</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071227<div class="paragraph"><p>After deciding the fate for all hunks, if there is any hunk
Junio C Hamano46a38aa2008-07-14 03:13:271228that was chosen, the index is updated with the selected hunks.</p></div>
Junio C Hamano9eb58352011-05-11 20:09:241229<div class="paragraph"><p>You can omit having to type return here, by setting the configuration
Junio C Hamano322c6242015-03-23 21:32:461230variable <code>interactive.singleKey</code> to <code>true</code>.</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311231</dd>
Junio C Hamano97bcb482010-11-25 03:16:071232<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311233diff
1234</dt>
1235<dd>
1236<p>
1237 This lets you review what will be committed (i.e. between
1238 HEAD and index).
1239</p>
1240</dd>
Junio C Hamano46a38aa2008-07-14 03:13:271241</dl></div>
Junio C Hamano17bbaca2006-12-25 11:36:311242</div>
Junio C Hamano9d971152012-12-19 00:43:111243</div>
1244<div class="sect1">
Junio C Hamano97bcb482010-11-25 03:16:071245<h2 id="_editing_patches">EDITING PATCHES</h2>
1246<div class="sectionbody">
Junio C Hamanoc14e6ad2014-10-31 20:25:531247<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:071248selector will open a patch in your editor; after the editor exits, the
1249result is applied to the index. You are free to make arbitrary changes
1250to the patch, but note that some changes may have confusing results, or
1251even result in a patch that cannot be applied. If you want to abort the
1252operation entirely (i.e., stage nothing new in the index), simply delete
1253all lines of the patch. The list below describes some common things you
1254may see in a patch, and which editing operations make sense on them.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111255<div class="openblock">
1256<div class="content">
Junio C Hamano97bcb482010-11-25 03:16:071257<div class="dlist"><dl>
1258<dt class="hdlist1">
1259added content
1260</dt>
1261<dd>
1262<p>
1263Added content is represented by lines beginning with "&#43;". You can
1264prevent staging any addition lines by deleting them.
1265</p>
1266</dd>
1267<dt class="hdlist1">
1268removed content
1269</dt>
1270<dd>
1271<p>
1272Removed content is represented by lines beginning with "-". You can
1273prevent staging their removal by converting the "-" to a " " (space).
1274</p>
1275</dd>
1276<dt class="hdlist1">
1277modified content
1278</dt>
1279<dd>
1280<p>
1281Modified content is represented by "-" lines (removing the old content)
1282followed by "&#43;" lines (adding the replacement content). You can
1283prevent staging the modification by converting "-" lines to " ", and
1284removing "&#43;" lines. Beware that modifying only half of the pair is
1285likely to introduce confusing changes to the index.
1286</p>
1287</dd>
1288</dl></div>
Junio C Hamano9d971152012-12-19 00:43:111289</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071290<div class="paragraph"><p>There are also more complex operations that can be performed. But beware
1291that because the patch is applied only to the index and not the working
1292tree, the working tree will appear to "undo" the change in the index.
Junio C Hamano7165bf72011-01-04 22:06:181293For example, introducing a new line into the index that is in neither
Junio C Hamano97bcb482010-11-25 03:16:071294the HEAD nor the working tree will stage the new line for commit, but
1295the line will appear to be reverted in the working tree.</p></div>
1296<div class="paragraph"><p>Avoid using these constructs, or do so with extreme caution.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111297<div class="openblock">
1298<div class="content">
Junio C Hamano97bcb482010-11-25 03:16:071299<div class="dlist"><dl>
1300<dt class="hdlist1">
1301removing untouched content
1302</dt>
1303<dd>
1304<p>
1305Content which does not differ between the index and working tree may be
1306shown on context lines, beginning with a " " (space). You can stage
1307context lines for removal by converting the space to a "-". The
1308resulting working tree file will appear to re-add the content.
1309</p>
1310</dd>
1311<dt class="hdlist1">
1312modifying existing content
1313</dt>
1314<dd>
1315<p>
1316One can also modify context lines by staging them for removal (by
1317converting " " to "-") and adding a "&#43;" line with the new content.
1318Similarly, one can modify "&#43;" lines for existing additions or
1319modifications. In all cases, the new modification will appear reverted
1320in the working tree.
1321</p>
1322</dd>
1323<dt class="hdlist1">
1324new content
1325</dt>
1326<dd>
1327<p>
1328You may also add new content that does not exist in the patch; simply
1329add new lines, each starting with "&#43;". The addition will appear
1330reverted in the working tree.
1331</p>
1332</dd>
1333</dl></div>
Junio C Hamano9d971152012-12-19 00:43:111334</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071335<div class="paragraph"><p>There are also several operations which should be avoided entirely, as
1336they will make the patch impossible to apply:</p></div>
1337<div class="ulist"><ul>
1338<li>
1339<p>
1340adding context (" ") or removal ("-") lines
1341</p>
1342</li>
1343<li>
1344<p>
1345deleting context or removal lines
1346</p>
1347</li>
1348<li>
1349<p>
1350modifying the contents of context or removal lines
1351</p>
1352</li>
1353</ul></div>
1354</div>
Junio C Hamano9d971152012-12-19 00:43:111355</div>
1356<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:271357<h2 id="_see_also">SEE ALSO</h2>
Junio C Hamano2bb13102006-03-06 07:10:211358<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:231359<div class="paragraph"><p><a href="git-status.html">git-status(1)</a>
1360<a href="git-rm.html">git-rm(1)</a>
1361<a href="git-reset.html">git-reset(1)</a>
1362<a href="git-mv.html">git-mv(1)</a>
1363<a href="git-commit.html">git-commit(1)</a>
1364<a href="git-update-index.html">git-update-index(1)</a></p></div>
Junio C Hamano2bb13102006-03-06 07:10:211365</div>
Junio C Hamano9d971152012-12-19 00:43:111366</div>
1367<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:271368<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231369<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:231370<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231371</div>
Junio C Hamano7bd050f2011-09-22 06:32:221372</div>
Junio C Hamano9d971152012-12-19 00:43:111373</div>
Junio C Hamano7bd050f2011-09-22 06:32:221374<div id="footnotes"><hr /></div>
Junio C Hamano1a4e8412005-12-27 08:17:231375<div id="footer">
1376<div id="footer-text">
Junio C Hamano2ef0ba32018-01-26 23:13:531377Last updated
Junio C Hamano7a46cd62020-03-15 21:57:101378 2020-03-10 08:03:13 PDT
Junio C Hamano1a4e8412005-12-27 08:17:231379</div>
1380</div>
1381</body>
1382</html>