blob: 6860828230b62a25d3981558a562705d9d01aa67 [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
Junio C Hamano9d971152012-12-19 00:43:115<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
Junio C Hamanoc14e6ad2014-10-31 20:25:536<meta name="generator" content="AsciiDoc 8.6.9" />
Junio C Hamano97bcb482010-11-25 03:16:077<title>git-add(1)</title>
Junio C Hamano1a4e8412005-12-27 08:17:238<style type="text/css">
Junio C Hamano9d971152012-12-19 00:43:119/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
10
11/* Default font. */
12body {
13 font-family: Georgia,serif;
14}
15
16/* Title font. */
17h1, h2, h3, h4, h5, h6,
18div.title, caption.title,
19thead, p.table.header,
20#toctitle,
21#author, #revnumber, #revdate, #revremark,
22#footer {
23 font-family: Arial,Helvetica,sans-serif;
Junio C Hamano1a4e8412005-12-27 08:17:2324}
25
26body {
27 margin: 1em 5% 1em 5%;
28}
29
Junio C Hamano46a38aa2008-07-14 03:13:2730a {
31 color: blue;
32 text-decoration: underline;
33}
34a:visited {
35 color: fuchsia;
36}
Junio C Hamano1a4e8412005-12-27 08:17:2337
38em {
39 font-style: italic;
Junio C Hamano97bcb482010-11-25 03:16:0740 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2341}
42
43strong {
44 font-weight: bold;
Junio C Hamano97bcb482010-11-25 03:16:0745 color: #083194;
Junio C Hamano1a4e8412005-12-27 08:17:2346}
47
Junio C Hamano1a4e8412005-12-27 08:17:2348h1, h2, h3, h4, h5, h6 {
49 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:2350 margin-top: 1.2em;
51 margin-bottom: 0.5em;
52 line-height: 1.3;
53}
54
Junio C Hamano46a38aa2008-07-14 03:13:2755h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2356 border-bottom: 2px solid silver;
57}
58h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2359 padding-top: 0.5em;
60}
Junio C Hamano46a38aa2008-07-14 03:13:2761h3 {
62 float: left;
63}
64h3 + * {
65 clear: left;
66}
Junio C Hamano9d971152012-12-19 00:43:1167h5 {
68 font-size: 1.0em;
69}
Junio C Hamano1a4e8412005-12-27 08:17:2370
71div.sectionbody {
Junio C Hamano1a4e8412005-12-27 08:17:2372 margin-left: 0;
73}
74
75hr {
76 border: 1px solid silver;
77}
78
79p {
80 margin-top: 0.5em;
81 margin-bottom: 0.5em;
82}
83
Junio C Hamano97bcb482010-11-25 03:16:0784ul, ol, li > p {
85 margin-top: 0;
86}
Junio C Hamano9d971152012-12-19 00:43:1187ul > li { color: #aaa; }
88ul > li > * { color: black; }
Junio C Hamano97bcb482010-11-25 03:16:0789
Junio C Hamanoc14e6ad2014-10-31 20:25:5390.monospaced, code, pre {
91 font-family: "Courier New", Courier, monospace;
92 font-size: inherit;
93 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2394 padding: 0;
95 margin: 0;
96}
Junio C Hamanoc14e6ad2014-10-31 20:25:5397pre {
98 white-space: pre-wrap;
99}
Junio C Hamano1a4e8412005-12-27 08:17:23100
Junio C Hamano9d971152012-12-19 00:43:11101#author {
Junio C Hamano1a4e8412005-12-27 08:17:23102 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23103 font-weight: bold;
Junio C Hamano46a38aa2008-07-14 03:13:27104 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23105}
Junio C Hamano9d971152012-12-19 00:43:11106#email {
Junio C Hamano1a4e8412005-12-27 08:17:23107}
Junio C Hamano9d971152012-12-19 00:43:11108#revnumber, #revdate, #revremark {
Junio C Hamano1a4e8412005-12-27 08:17:23109}
110
Junio C Hamano9d971152012-12-19 00:43:11111#footer {
Junio C Hamano1a4e8412005-12-27 08:17:23112 font-size: small;
113 border-top: 2px solid silver;
114 padding-top: 0.5em;
115 margin-top: 4.0em;
116}
Junio C Hamano9d971152012-12-19 00:43:11117#footer-text {
Junio C Hamano1a4e8412005-12-27 08:17:23118 float: left;
119 padding-bottom: 0.5em;
120}
Junio C Hamano9d971152012-12-19 00:43:11121#footer-badges {
Junio C Hamano1a4e8412005-12-27 08:17:23122 float: right;
123 padding-bottom: 0.5em;
124}
125
Junio C Hamano9d971152012-12-19 00:43:11126#preamble {
Junio C Hamano97bcb482010-11-25 03:16:07127 margin-top: 1.5em;
128 margin-bottom: 1.5em;
129}
Junio C Hamano9d971152012-12-19 00:43:11130div.imageblock, div.exampleblock, div.verseblock,
Junio C Hamano1a4e8412005-12-27 08:17:23131div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
132div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22133 margin-top: 1.0em;
Junio C Hamano1a4e8412005-12-27 08:17:23134 margin-bottom: 1.5em;
135}
136div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22137 margin-top: 2.0em;
138 margin-bottom: 2.0em;
139 margin-right: 10%;
140 color: #606060;
Junio C Hamano1a4e8412005-12-27 08:17:23141}
142
143div.content { /* Block element content. */
144 padding: 0;
145}
146
147/* Block element titles. */
148div.title, caption.title {
Junio C Hamano97bcb482010-11-25 03:16:07149 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23150 font-weight: bold;
151 text-align: left;
152 margin-top: 1.0em;
153 margin-bottom: 0.5em;
154}
155div.title + * {
156 margin-top: 0;
157}
158
159td div.title:first-child {
160 margin-top: 0.0em;
161}
162div.content div.title:first-child {
163 margin-top: 0.0em;
164}
165div.content + div.title {
166 margin-top: 0.0em;
167}
168
169div.sidebarblock > div.content {
170 background: #ffffee;
Junio C Hamano9d971152012-12-19 00:43:11171 border: 1px solid #dddddd;
172 border-left: 4px solid #f0f0f0;
Junio C Hamano1a4e8412005-12-27 08:17:23173 padding: 0.5em;
174}
175
176div.listingblock > div.content {
Junio C Hamano9d971152012-12-19 00:43:11177 border: 1px solid #dddddd;
178 border-left: 5px solid #f0f0f0;
179 background: #f8f8f8;
Junio C Hamano1a4e8412005-12-27 08:17:23180 padding: 0.5em;
181}
182
Junio C Hamano7bd050f2011-09-22 06:32:22183div.quoteblock, div.verseblock {
184 padding-left: 1.0em;
185 margin-left: 1.0em;
Junio C Hamano97bcb482010-11-25 03:16:07186 margin-right: 10%;
Junio C Hamano9d971152012-12-19 00:43:11187 border-left: 5px solid #f0f0f0;
188 color: #888;
Junio C Hamano1a4e8412005-12-27 08:17:23189}
Junio C Hamano7bd050f2011-09-22 06:32:22190
Junio C Hamano97bcb482010-11-25 03:16:07191div.quoteblock > div.attribution {
192 padding-top: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23193 text-align: right;
194}
Junio C Hamano97bcb482010-11-25 03:16:07195
Junio C Hamano9d971152012-12-19 00:43:11196div.verseblock > pre.content {
197 font-family: inherit;
198 font-size: inherit;
Junio C Hamano97bcb482010-11-25 03:16:07199}
200div.verseblock > div.attribution {
201 padding-top: 0.75em;
202 text-align: left;
203}
204/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamano46a38aa2008-07-14 03:13:27205div.verseblock + div.attribution {
206 text-align: left;
207}
Junio C Hamano1a4e8412005-12-27 08:17:23208
209div.admonitionblock .icon {
210 vertical-align: top;
211 font-size: 1.1em;
212 font-weight: bold;
213 text-decoration: underline;
214 color: #527bbd;
215 padding-right: 0.5em;
216}
217div.admonitionblock td.content {
218 padding-left: 0.5em;
Junio C Hamano7bd050f2011-09-22 06:32:22219 border-left: 3px solid #dddddd;
Junio C Hamano1a4e8412005-12-27 08:17:23220}
221
222div.exampleblock > div.content {
Junio C Hamano7bd050f2011-09-22 06:32:22223 border-left: 3px solid #dddddd;
224 padding-left: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23225}
226
Junio C Hamano1a4e8412005-12-27 08:17:23227div.imageblock div.content { padding-left: 0; }
Junio C Hamanoc14e6ad2014-10-31 20:25:53228span.image img { border-style: none; vertical-align: text-bottom; }
Junio C Hamano97bcb482010-11-25 03:16:07229a.image:visited { color: white; }
Junio C Hamano1a4e8412005-12-27 08:17:23230
231dl {
232 margin-top: 0.8em;
233 margin-bottom: 0.8em;
234}
235dt {
236 margin-top: 0.5em;
237 margin-bottom: 0;
Junio C Hamano97bcb482010-11-25 03:16:07238 font-style: normal;
239 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23240}
241dd > *:first-child {
Junio C Hamano97bcb482010-11-25 03:16:07242 margin-top: 0.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23243}
244
245ul, ol {
246 list-style-position: outside;
247}
Junio C Hamano97bcb482010-11-25 03:16:07248ol.arabic {
249 list-style-type: decimal;
250}
251ol.loweralpha {
Junio C Hamano1a4e8412005-12-27 08:17:23252 list-style-type: lower-alpha;
253}
Junio C Hamano97bcb482010-11-25 03:16:07254ol.upperalpha {
255 list-style-type: upper-alpha;
256}
257ol.lowerroman {
258 list-style-type: lower-roman;
259}
260ol.upperroman {
261 list-style-type: upper-roman;
262}
263
264div.compact ul, div.compact ol,
265div.compact p, div.compact p,
266div.compact div, div.compact div {
267 margin-top: 0.1em;
268 margin-bottom: 0.1em;
269}
Junio C Hamano1a4e8412005-12-27 08:17:23270
Junio C Hamano1a4e8412005-12-27 08:17:23271tfoot {
272 font-weight: bold;
273}
Junio C Hamano97bcb482010-11-25 03:16:07274td > div.verse {
275 white-space: pre;
276}
Junio C Hamano97bcb482010-11-25 03:16:07277
278div.hdlist {
Junio C Hamano1a4e8412005-12-27 08:17:23279 margin-top: 0.8em;
280 margin-bottom: 0.8em;
281}
Junio C Hamano97bcb482010-11-25 03:16:07282div.hdlist tr {
283 padding-bottom: 15px;
Junio C Hamano46a38aa2008-07-14 03:13:27284}
Junio C Hamano97bcb482010-11-25 03:16:07285dt.hdlist1.strong, td.hdlist1.strong {
286 font-weight: bold;
287}
288td.hdlist1 {
Junio C Hamano1a4e8412005-12-27 08:17:23289 vertical-align: top;
Junio C Hamano97bcb482010-11-25 03:16:07290 font-style: normal;
Junio C Hamano1a4e8412005-12-27 08:17:23291 padding-right: 0.8em;
Junio C Hamano97bcb482010-11-25 03:16:07292 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23293}
Junio C Hamano97bcb482010-11-25 03:16:07294td.hdlist2 {
Junio C Hamano1a4e8412005-12-27 08:17:23295 vertical-align: top;
296}
Junio C Hamano97bcb482010-11-25 03:16:07297div.hdlist.compact tr {
298 margin: 0;
299 padding-bottom: 0;
300}
301
302.comment {
303 background: yellow;
304}
Junio C Hamano1a4e8412005-12-27 08:17:23305
Junio C Hamano7bd050f2011-09-22 06:32:22306.footnote, .footnoteref {
307 font-size: 0.8em;
308}
309
310span.footnote, span.footnoteref {
311 vertical-align: super;
312}
313
314#footnotes {
315 margin: 20px 0 20px 0;
316 padding: 7px 0 0 0;
317}
318
319#footnotes div.footnote {
320 margin: 0 0 5px 0;
321}
322
323#footnotes hr {
324 border: none;
325 border-top: 1px solid silver;
326 height: 1px;
327 text-align: left;
328 margin-left: 0;
329 width: 20%;
330 min-width: 100px;
331}
332
Junio C Hamano9d971152012-12-19 00:43:11333div.colist td {
334 padding-right: 0.5em;
335 padding-bottom: 0.3em;
336 vertical-align: top;
337}
338div.colist td img {
339 margin-top: 0.3em;
Junio C Hamano1a4e8412005-12-27 08:17:23340}
Junio C Hamano46a38aa2008-07-14 03:13:27341
Junio C Hamano9d971152012-12-19 00:43:11342@media print {
343 #footer-badges { display: none; }
344}
345
346#toc {
Junio C Hamano7bd050f2011-09-22 06:32:22347 margin-bottom: 2.5em;
348}
349
Junio C Hamano9d971152012-12-19 00:43:11350#toctitle {
Junio C Hamano46a38aa2008-07-14 03:13:27351 color: #527bbd;
Junio C Hamano46a38aa2008-07-14 03:13:27352 font-size: 1.1em;
353 font-weight: bold;
354 margin-top: 1.0em;
355 margin-bottom: 0.1em;
356}
357
Junio C Hamanoc14e6ad2014-10-31 20:25:53358div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
Junio C Hamano46a38aa2008-07-14 03:13:27359 margin-top: 0;
360 margin-bottom: 0;
361}
362div.toclevel2 {
363 margin-left: 2em;
364 font-size: 0.9em;
365}
366div.toclevel3 {
367 margin-left: 4em;
368 font-size: 0.9em;
369}
370div.toclevel4 {
371 margin-left: 6em;
372 font-size: 0.9em;
373}
Junio C Hamano9d971152012-12-19 00:43:11374
375span.aqua { color: aqua; }
376span.black { color: black; }
377span.blue { color: blue; }
378span.fuchsia { color: fuchsia; }
379span.gray { color: gray; }
380span.green { color: green; }
381span.lime { color: lime; }
382span.maroon { color: maroon; }
383span.navy { color: navy; }
384span.olive { color: olive; }
385span.purple { color: purple; }
386span.red { color: red; }
387span.silver { color: silver; }
388span.teal { color: teal; }
389span.white { color: white; }
390span.yellow { color: yellow; }
391
392span.aqua-background { background: aqua; }
393span.black-background { background: black; }
394span.blue-background { background: blue; }
395span.fuchsia-background { background: fuchsia; }
396span.gray-background { background: gray; }
397span.green-background { background: green; }
398span.lime-background { background: lime; }
399span.maroon-background { background: maroon; }
400span.navy-background { background: navy; }
401span.olive-background { background: olive; }
402span.purple-background { background: purple; }
403span.red-background { background: red; }
404span.silver-background { background: silver; }
405span.teal-background { background: teal; }
406span.white-background { background: white; }
407span.yellow-background { background: yellow; }
408
409span.big { font-size: 2em; }
410span.small { font-size: 0.6em; }
411
412span.underline { text-decoration: underline; }
413span.overline { text-decoration: overline; }
414span.line-through { text-decoration: line-through; }
415
Junio C Hamanoc14e6ad2014-10-31 20:25:53416div.unbreakable { page-break-inside: avoid; }
417
Junio C Hamano9d971152012-12-19 00:43:11418
419/*
420 * xhtml11 specific
421 *
422 * */
423
424div.tableblock {
425 margin-top: 1.0em;
426 margin-bottom: 1.5em;
427}
428div.tableblock > table {
429 border: 3px solid #527bbd;
430}
431thead, p.table.header {
432 font-weight: bold;
433 color: #527bbd;
434}
435p.table {
436 margin-top: 0;
437}
438/* Because the table frame attribute is overriden by CSS in most browsers. */
439div.tableblock > table[frame="void"] {
440 border-style: none;
441}
442div.tableblock > table[frame="hsides"] {
443 border-left-style: none;
444 border-right-style: none;
445}
446div.tableblock > table[frame="vsides"] {
447 border-top-style: none;
448 border-bottom-style: none;
449}
450
451
452/*
453 * html5 specific
454 *
455 * */
456
457table.tableblock {
458 margin-top: 1.0em;
459 margin-bottom: 1.5em;
460}
461thead, p.tableblock.header {
462 font-weight: bold;
463 color: #527bbd;
464}
465p.tableblock {
466 margin-top: 0;
467}
468table.tableblock {
469 border-width: 3px;
470 border-spacing: 0px;
471 border-style: solid;
472 border-color: #527bbd;
473 border-collapse: collapse;
474}
475th.tableblock, td.tableblock {
476 border-width: 1px;
477 padding: 4px;
478 border-style: solid;
479 border-color: #527bbd;
480}
481
482table.tableblock.frame-topbot {
483 border-left-style: hidden;
484 border-right-style: hidden;
485}
486table.tableblock.frame-sides {
487 border-top-style: hidden;
488 border-bottom-style: hidden;
489}
490table.tableblock.frame-none {
491 border-style: hidden;
492}
493
494th.tableblock.halign-left, td.tableblock.halign-left {
495 text-align: left;
496}
497th.tableblock.halign-center, td.tableblock.halign-center {
498 text-align: center;
499}
500th.tableblock.halign-right, td.tableblock.halign-right {
501 text-align: right;
502}
503
504th.tableblock.valign-top, td.tableblock.valign-top {
505 vertical-align: top;
506}
507th.tableblock.valign-middle, td.tableblock.valign-middle {
508 vertical-align: middle;
509}
510th.tableblock.valign-bottom, td.tableblock.valign-bottom {
511 vertical-align: bottom;
512}
513
514
515/*
516 * manpage specific
517 *
518 * */
519
520body.manpage h1 {
Junio C Hamano97bcb482010-11-25 03:16:07521 padding-top: 0.5em;
522 padding-bottom: 0.5em;
523 border-top: 2px solid silver;
524 border-bottom: 2px solid silver;
525}
Junio C Hamano9d971152012-12-19 00:43:11526body.manpage h2 {
Junio C Hamano97bcb482010-11-25 03:16:07527 border-style: none;
528}
Junio C Hamano9d971152012-12-19 00:43:11529body.manpage div.sectionbody {
530 margin-left: 3em;
Junio C Hamano97bcb482010-11-25 03:16:07531}
532
533@media print {
Junio C Hamano9d971152012-12-19 00:43:11534 body.manpage div#toc { display: none; }
Junio C Hamano97bcb482010-11-25 03:16:07535}
Junio C Hamanoc14e6ad2014-10-31 20:25:53536
537
Junio C Hamano1a4e8412005-12-27 08:17:23538</style>
Junio C Hamano7bd050f2011-09-22 06:32:22539<script type="text/javascript">
540/*<![CDATA[*/
Junio C Hamano7bd050f2011-09-22 06:32:22541var asciidoc = { // Namespace.
542
543/////////////////////////////////////////////////////////////////////
544// Table Of Contents generator
545/////////////////////////////////////////////////////////////////////
546
547/* Author: Mihai Bazon, September 2002
548 * http://students.infoiasi.ro/~mishoo
549 *
550 * Table Of Content generator
551 * Version: 0.4
552 *
553 * Feel free to use this script under the terms of the GNU General Public
554 * License, as long as you do not remove or alter this notice.
555 */
556
557 /* modified by Troy D. Hanson, September 2006. License: GPL */
558 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
559
560// toclevels = 1..4.
561toc: function (toclevels) {
562
563 function getText(el) {
564 var text = "";
565 for (var i = el.firstChild; i != null; i = i.nextSibling) {
566 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
567 text += i.data;
568 else if (i.firstChild != null)
569 text += getText(i);
570 }
571 return text;
572 }
573
574 function TocEntry(el, text, toclevel) {
575 this.element = el;
576 this.text = text;
577 this.toclevel = toclevel;
578 }
579
580 function tocEntries(el, toclevels) {
581 var result = new Array;
Junio C Hamanoc14e6ad2014-10-31 20:25:53582 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
Junio C Hamano7bd050f2011-09-22 06:32:22583 // Function that scans the DOM tree for header elements (the DOM2
584 // nodeIterator API would be a better technique but not supported by all
585 // browsers).
586 var iterate = function (el) {
587 for (var i = el.firstChild; i != null; i = i.nextSibling) {
588 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
589 var mo = re.exec(i.tagName);
590 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
591 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
592 }
593 iterate(i);
594 }
595 }
596 }
597 iterate(el);
598 return result;
599 }
600
601 var toc = document.getElementById("toc");
Junio C Hamano9d971152012-12-19 00:43:11602 if (!toc) {
603 return;
604 }
605
606 // Delete existing TOC entries in case we're reloading the TOC.
607 var tocEntriesToRemove = [];
608 var i;
609 for (i = 0; i < toc.childNodes.length; i++) {
610 var entry = toc.childNodes[i];
Junio C Hamanoc14e6ad2014-10-31 20:25:53611 if (entry.nodeName.toLowerCase() == 'div'
Junio C Hamano9d971152012-12-19 00:43:11612 && entry.getAttribute("class")
613 && entry.getAttribute("class").match(/^toclevel/))
614 tocEntriesToRemove.push(entry);
615 }
616 for (i = 0; i < tocEntriesToRemove.length; i++) {
617 toc.removeChild(tocEntriesToRemove[i]);
618 }
619
620 // Rebuild TOC entries.
Junio C Hamano7bd050f2011-09-22 06:32:22621 var entries = tocEntries(document.getElementById("content"), toclevels);
622 for (var i = 0; i < entries.length; ++i) {
623 var entry = entries[i];
624 if (entry.element.id == "")
625 entry.element.id = "_toc_" + i;
626 var a = document.createElement("a");
627 a.href = "#" + entry.element.id;
628 a.appendChild(document.createTextNode(entry.text));
629 var div = document.createElement("div");
630 div.appendChild(a);
631 div.className = "toclevel" + entry.toclevel;
632 toc.appendChild(div);
633 }
634 if (entries.length == 0)
635 toc.parentNode.removeChild(toc);
636},
637
638
639/////////////////////////////////////////////////////////////////////
640// Footnotes generator
641/////////////////////////////////////////////////////////////////////
642
643/* Based on footnote generation code from:
644 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
645 */
646
647footnotes: function () {
Junio C Hamano9d971152012-12-19 00:43:11648 // Delete existing footnote entries in case we're reloading the footnodes.
649 var i;
Junio C Hamano7bd050f2011-09-22 06:32:22650 var noteholder = document.getElementById("footnotes");
Junio C Hamano9d971152012-12-19 00:43:11651 if (!noteholder) {
652 return;
653 }
654 var entriesToRemove = [];
655 for (i = 0; i < noteholder.childNodes.length; i++) {
656 var entry = noteholder.childNodes[i];
Junio C Hamanoc14e6ad2014-10-31 20:25:53657 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
Junio C Hamano9d971152012-12-19 00:43:11658 entriesToRemove.push(entry);
659 }
660 for (i = 0; i < entriesToRemove.length; i++) {
661 noteholder.removeChild(entriesToRemove[i]);
662 }
663
664 // Rebuild footnote entries.
665 var cont = document.getElementById("content");
Junio C Hamano7bd050f2011-09-22 06:32:22666 var spans = cont.getElementsByTagName("span");
667 var refs = {};
668 var n = 0;
669 for (i=0; i<spans.length; i++) {
670 if (spans[i].className == "footnote") {
671 n++;
Junio C Hamano9d971152012-12-19 00:43:11672 var note = spans[i].getAttribute("data-note");
673 if (!note) {
674 // Use [\s\S] in place of . so multi-line matches work.
675 // Because JavaScript has no s (dotall) regex flag.
676 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
677 spans[i].innerHTML =
678 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
679 "' title='View footnote' class='footnote'>" + n + "</a>]";
680 spans[i].setAttribute("data-note", note);
681 }
Junio C Hamano7bd050f2011-09-22 06:32:22682 noteholder.innerHTML +=
683 "<div class='footnote' id='_footnote_" + n + "'>" +
684 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
685 n + "</a>. " + note + "</div>";
Junio C Hamano7bd050f2011-09-22 06:32:22686 var id =spans[i].getAttribute("id");
687 if (id != null) refs["#"+id] = n;
688 }
689 }
690 if (n == 0)
691 noteholder.parentNode.removeChild(noteholder);
692 else {
693 // Process footnoterefs.
694 for (i=0; i<spans.length; i++) {
695 if (spans[i].className == "footnoteref") {
696 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
697 href = href.match(/#.*/)[0]; // Because IE return full URL.
698 n = refs[href];
699 spans[i].innerHTML =
700 "[<a href='#_footnote_" + n +
701 "' title='View footnote' class='footnote'>" + n + "</a>]";
702 }
703 }
704 }
Junio C Hamano9d971152012-12-19 00:43:11705},
706
707install: function(toclevels) {
708 var timerId;
709
710 function reinstall() {
711 asciidoc.footnotes();
712 if (toclevels) {
713 asciidoc.toc(toclevels);
714 }
715 }
716
717 function reinstallAndRemoveTimer() {
718 clearInterval(timerId);
719 reinstall();
720 }
721
722 timerId = setInterval(reinstall, 500);
723 if (document.addEventListener)
724 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
725 else
726 window.onload = reinstallAndRemoveTimer;
Junio C Hamano7bd050f2011-09-22 06:32:22727}
728
729}
Junio C Hamano9d971152012-12-19 00:43:11730asciidoc.install();
Junio C Hamano7bd050f2011-09-22 06:32:22731/*]]>*/
732</script>
Junio C Hamano1a4e8412005-12-27 08:17:23733</head>
Junio C Hamano9d971152012-12-19 00:43:11734<body class="manpage">
Junio C Hamano1a4e8412005-12-27 08:17:23735<div id="header">
736<h1>
737git-add(1) Manual Page
738</h1>
739<h2>NAME</h2>
740<div class="sectionbody">
741<p>git-add -
Junio C Hamano4cd1c0e2007-08-06 04:39:14742 Add file contents to the index
Junio C Hamano1a4e8412005-12-27 08:17:23743</p>
744</div>
745</div>
Junio C Hamano7bd050f2011-09-22 06:32:22746<div id="content">
Junio C Hamano9d971152012-12-19 00:43:11747<div class="sect1">
Junio C Hamano97bcb482010-11-25 03:16:07748<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23749<div class="sectionbody">
Junio C Hamano8b8b0f22007-08-26 22:10:26750<div class="verseblock">
Junio C Hamanoe8acc8e2015-01-14 22:01:34751<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:04752 [--edit | -e] [--[no-]all | --[no-]ignore-removal | [--update | -u]]
753 [--intent-to-add | -N] [--refresh] [--ignore-errors] [--ignore-missing]
754 [--] [&lt;pathspec&gt;&#8230;]</pre>
Junio C Hamano9d971152012-12-19 00:43:11755<div class="attribution">
Junio C Hamano97bcb482010-11-25 03:16:07756</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23757</div>
Junio C Hamano9d971152012-12-19 00:43:11758</div>
759<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:27760<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23761<div class="sectionbody">
Junio C Hamano97bcb482010-11-25 03:16:07762<div class="paragraph"><p>This command updates the index using the current content found in
Junio C Hamanoae05fee2010-01-08 07:39:46763the working tree, to prepare the content staged for the next commit.
764It typically adds the current content of existing paths as a whole,
765but with some options it can also be used to add content with
766only part of the changes made to the working tree files applied, or
767remove paths that do not exist in the working tree anymore.</p></div>
Junio C Hamano97bcb482010-11-25 03:16:07768<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:14769is this snapshot that is taken as the contents of the next commit. Thus
Junio C Hamanoffe10ca2016-02-04 00:44:23770after making any changes to the working tree, and before running
Junio C Hamanoc14e6ad2014-10-31 20:25:53771the commit command, you must use the <code>add</code> command to add any new or
Junio C Hamano46a38aa2008-07-14 03:13:27772modified files to the index.</p></div>
Junio C Hamano97bcb482010-11-25 03:16:07773<div class="paragraph"><p>This command can be performed multiple times before a commit. It only
Junio C Hamano4cd1c0e2007-08-06 04:39:14774adds the content of the specified file(s) at the time the add command is
775run; if you want subsequent changes included in the next commit, then
Junio C Hamanoc14e6ad2014-10-31 20:25:53776you must run <code>git add</code> again to add the new content to the index.</p></div>
777<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:27778files have changes that are staged for the next commit.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:53779<div class="paragraph"><p>The <code>git add</code> command will not add ignored files by default. If any
780ignored files were explicitly specified on the command line, <code>git add</code>
Junio C Hamano3c1f2c72007-08-17 07:48:05781will fail with a list of ignored files. Ignored files reached by
Junio C Hamano7d9e9bd2007-08-29 07:31:47782directory recursion or filename globbing performed by Git (quote your
Junio C Hamano1aa40d22010-01-21 17:46:43783globs before the shell) will be silently ignored. The <em>git add</em> command can
Junio C Hamanoc14e6ad2014-10-31 20:25:53784be used to add ignored files with the <code>-f</code> (force) option.</p></div>
Junio C Hamanoa28a9202012-06-21 07:08:23785<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:27786commit.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23787</div>
Junio C Hamano9d971152012-12-19 00:43:11788</div>
789<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:27790<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23791<div class="sectionbody">
Junio C Hamano97bcb482010-11-25 03:16:07792<div class="dlist"><dl>
793<dt class="hdlist1">
Junio C Hamanobca4cd62013-02-13 00:01:02794&lt;pathspec&gt;&#8230;
Junio C Hamano1a4e8412005-12-27 08:17:23795</dt>
796<dd>
797<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53798 Files to add content from. Fileglobs (e.g. <code>*.c</code>) can
Junio C Hamano3d2adc72006-12-26 03:21:45799 be given to add all matching files. Also a
Junio C Hamanoc14e6ad2014-10-31 20:25:53800 leading directory name (e.g. <code>dir</code> to add <code>dir/file1</code>
801 and <code>dir/file2</code>) can be given to update the index to
Junio C Hamano1d669b82014-03-11 21:36:00802 match the current state of the directory as a whole (e.g.
Junio C Hamanoc14e6ad2014-10-31 20:25:53803 specifying <code>dir</code> will record not just a file <code>dir/file1</code>
804 modified in the working tree, a file <code>dir/file2</code> added to
805 the working tree, but also a file <code>dir/file3</code> removed from
Junio C Hamano1d669b82014-03-11 21:36:00806 the working tree. Note that older versions of Git used
Junio C Hamanoc14e6ad2014-10-31 20:25:53807 to ignore removed files; use <code>--no-all</code> option if you want
Junio C Hamano1d669b82014-03-11 21:36:00808 to add modified or new files but ignore removed ones.
Junio C Hamano1a4e8412005-12-27 08:17:23809</p>
810</dd>
Junio C Hamano97bcb482010-11-25 03:16:07811<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47812-n
813</dt>
Junio C Hamano97bcb482010-11-25 03:16:07814<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47815--dry-run
Junio C Hamano1a4e8412005-12-27 08:17:23816</dt>
817<dd>
818<p>
Junio C Hamano97bcb482010-11-25 03:16:07819 Don&#8217;t actually add the file(s), just show if they exist and/or will
Junio C Hamanoafabd322010-07-19 20:26:15820 be ignored.
Junio C Hamano1a4e8412005-12-27 08:17:23821</p>
822</dd>
Junio C Hamano97bcb482010-11-25 03:16:07823<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47824-v
825</dt>
Junio C Hamano97bcb482010-11-25 03:16:07826<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47827--verbose
Junio C Hamano1a4e8412005-12-27 08:17:23828</dt>
829<dd>
830<p>
831 Be verbose.
832</p>
833</dd>
Junio C Hamano97bcb482010-11-25 03:16:07834<dt class="hdlist1">
Junio C Hamano3d2adc72006-12-26 03:21:45835-f
836</dt>
Junio C Hamano97bcb482010-11-25 03:16:07837<dt class="hdlist1">
Junio C Hamano00e884a2008-06-15 05:10:38838--force
839</dt>
Junio C Hamano3d2adc72006-12-26 03:21:45840<dd>
841<p>
842 Allow adding otherwise ignored files.
843</p>
844</dd>
Junio C Hamano97bcb482010-11-25 03:16:07845<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47846-i
847</dt>
Junio C Hamano97bcb482010-11-25 03:16:07848<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47849--interactive
Junio C Hamano17bbaca2006-12-25 11:36:31850</dt>
851<dd>
852<p>
853 Add modified contents in the working tree interactively to
Junio C Hamanoe0facb92007-12-05 10:59:48854 the index. Optional path arguments may be supplied to limit
855 operation to a subset of the working tree. See &#8220;Interactive
856 mode&#8221; for details.
Junio C Hamano17bbaca2006-12-25 11:36:31857</p>
858</dd>
Junio C Hamano97bcb482010-11-25 03:16:07859<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47860-p
861</dt>
Junio C Hamano97bcb482010-11-25 03:16:07862<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47863--patch
Junio C Hamano8d1e4712007-12-11 08:54:21864</dt>
865<dd>
866<p>
Junio C Hamano7df6dcf2009-09-13 09:51:17867 Interactively choose hunks of patch between the index and the
868 work tree and add them to the index. This gives the user a chance
869 to review the difference before adding modified contents to the
870 index.
Junio C Hamano8d1e4712007-12-11 08:54:21871</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53872<div class="paragraph"><p>This effectively runs <code>add --interactive</code>, but bypasses the
873initial command menu and directly jumps to the <code>patch</code> subcommand.
Junio C Hamanoe1b26832009-11-15 10:02:56874See &#8220;Interactive mode&#8221; for details.</p></div>
Junio C Hamano8d1e4712007-12-11 08:54:21875</dd>
Junio C Hamano97bcb482010-11-25 03:16:07876<dt class="hdlist1">
Junio C Hamano1dbca522015-05-22 20:48:55877-e
878</dt>
879<dt class="hdlist1">
880--edit
Junio C Hamano52ba2952009-05-18 17:43:02881</dt>
882<dd>
883<p>
884 Open the diff vs. the index in an editor and let the user
885 edit it. After the editor was closed, adjust the hunk headers
886 and apply the patch to the index.
887</p>
Junio C Hamano97bcb482010-11-25 03:16:07888<div class="paragraph"><p>The intent of this option is to pick and choose lines of the patch to
889apply, or even to modify the contents of lines to be staged. This can be
890quicker and more flexible than using the interactive hunk selector.
891However, it is easy to confuse oneself and create a patch that does not
892apply to the index. See EDITING PATCHES below.</p></div>
Junio C Hamano52ba2952009-05-18 17:43:02893</dd>
Junio C Hamano97bcb482010-11-25 03:16:07894<dt class="hdlist1">
Junio C Hamano3d30fd52007-05-08 00:32:53895-u
896</dt>
Junio C Hamano97bcb482010-11-25 03:16:07897<dt class="hdlist1">
Junio C Hamano00e884a2008-06-15 05:10:38898--update
899</dt>
Junio C Hamano3d30fd52007-05-08 00:32:53900<dd>
901<p>
Junio C Hamanof66c4632013-03-11 20:54:25902 Update the index just where it already has an entry matching
903 &lt;pathspec&gt;. This removes as well as modifies index entries to
904 match the working tree, but adds no new files.
Junio C Hamano3d30fd52007-05-08 00:32:53905</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53906<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:00907tracked files in the entire working tree are updated (old versions
908of Git used to limit the update to the current directory and its
909subdirectories).</p></div>
Junio C Hamano3d30fd52007-05-08 00:32:53910</dd>
Junio C Hamano97bcb482010-11-25 03:16:07911<dt class="hdlist1">
Junio C Hamano5ba2c222008-07-21 04:33:46912-A
913</dt>
Junio C Hamano97bcb482010-11-25 03:16:07914<dt class="hdlist1">
Junio C Hamano5ba2c222008-07-21 04:33:46915--all
916</dt>
Junio C Hamanof26c77e2013-04-27 00:06:04917<dt class="hdlist1">
918--no-ignore-removal
919</dt>
Junio C Hamano5ba2c222008-07-21 04:33:46920<dd>
921<p>
Junio C Hamanof66c4632013-03-11 20:54:25922 Update the index not only where the working tree has a file
923 matching &lt;pathspec&gt; but also where the index already has an
924 entry. This adds, modifies, and removes index entries to
925 match the working tree.
Junio C Hamano5ba2c222008-07-21 04:33:46926</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53927<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:00928files in the entire working tree are updated (old versions
929of Git used to limit the update to the current directory and its
930subdirectories).</p></div>
Junio C Hamano5ba2c222008-07-21 04:33:46931</dd>
Junio C Hamano97bcb482010-11-25 03:16:07932<dt class="hdlist1">
Junio C Hamanoc79bc672013-04-22 19:12:47933--no-all
934</dt>
Junio C Hamanof26c77e2013-04-27 00:06:04935<dt class="hdlist1">
936--ignore-removal
937</dt>
Junio C Hamanoc79bc672013-04-22 19:12:47938<dd>
939<p>
940 Update the index by adding new files that are unknown to the
941 index and files modified in the working tree, but ignore
942 files that have been removed from the working tree. This
943 option is a no-op when no &lt;pathspec&gt; is used.
944</p>
Junio C Hamano1d669b82014-03-11 21:36:00945<div class="paragraph"><p>This option is primarily to help users who are used to older
946versions of Git, whose "git add &lt;pathspec&gt;&#8230;" was a synonym
947for "git add --no-all &lt;pathspec&gt;&#8230;", i.e. ignored removed files.</p></div>
Junio C Hamanoc79bc672013-04-22 19:12:47948</dd>
949<dt class="hdlist1">
Junio C Hamano845880c2008-10-21 19:04:45950-N
951</dt>
Junio C Hamano97bcb482010-11-25 03:16:07952<dt class="hdlist1">
Junio C Hamano845880c2008-10-21 19:04:45953--intent-to-add
954</dt>
955<dd>
956<p>
957 Record only the fact that the path will be added later. An entry
958 for the path is placed in the index with no content. This is
959 useful for, among other things, showing the unstaged content of
Junio C Hamanoc14e6ad2014-10-31 20:25:53960 such files with <code>git diff</code> and committing them with <code>git commit
961 -a</code>.
Junio C Hamano845880c2008-10-21 19:04:45962</p>
963</dd>
Junio C Hamano97bcb482010-11-25 03:16:07964<dt class="hdlist1">
Junio C Hamano024b6c62007-08-14 09:43:08965--refresh
966</dt>
967<dd>
968<p>
Junio C Hamano97bcb482010-11-25 03:16:07969 Don&#8217;t add the file(s), but only refresh their stat()
Junio C Hamano024b6c62007-08-14 09:43:08970 information in the index.
971</p>
972</dd>
Junio C Hamano97bcb482010-11-25 03:16:07973<dt class="hdlist1">
Junio C Hamanofeeb1be2008-05-22 00:53:35974--ignore-errors
975</dt>
976<dd>
977<p>
978 If some files could not be added because of errors indexing
979 them, do not abort the operation, but continue adding the
980 others. The command shall still exit with non-zero status.
Junio C Hamanoc14e6ad2014-10-31 20:25:53981 The configuration variable <code>add.ignoreErrors</code> can be set to
Junio C Hamanob77f8192011-05-05 01:30:38982 true to make this the default behaviour.
Junio C Hamanofeeb1be2008-05-22 00:53:35983</p>
984</dd>
Junio C Hamano97bcb482010-11-25 03:16:07985<dt class="hdlist1">
Junio C Hamanoafabd322010-07-19 20:26:15986--ignore-missing
987</dt>
988<dd>
989<p>
990 This option can only be used together with --dry-run. By using
991 this option the user can check if any of the given files would
992 be ignored, no matter if they are already present in the work
993 tree or not.
994</p>
995</dd>
Junio C Hamano97bcb482010-11-25 03:16:07996<dt class="hdlist1">
Junio C Hamano1bb569e2006-05-05 23:14:25997--
Junio C Hamano7e9f6b72006-02-22 10:44:55998</dt>
999<dd>
1000<p>
1001 This option can be used to separate command-line options from
1002 the list of files, (useful when filenames might be mistaken
1003 for command-line options).
1004</p>
1005</dd>
Junio C Hamano46a38aa2008-07-14 03:13:271006</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:231007</div>
Junio C Hamano9d971152012-12-19 00:43:111008</div>
1009<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:271010<h2 id="_configuration">Configuration</h2>
Junio C Hamano9fbd4f72007-05-18 15:54:371011<div class="sectionbody">
Junio C Hamano322c6242015-03-23 21:32:461012<div class="paragraph"><p>The optional configuration variable <code>core.excludesFile</code> indicates a path to a
Junio C Hamano9fbd4f72007-05-18 15:54:371013file containing patterns of file names to exclude from git-add, similar to
1014$GIT_DIR/info/exclude. Patterns in the exclude file are used in addition to
Junio C Hamano4f07aec2012-09-25 19:08:441015those in info/exclude. See <a href="gitignore.html">gitignore(5)</a>.</p></div>
Junio C Hamano9fbd4f72007-05-18 15:54:371016</div>
Junio C Hamano9d971152012-12-19 00:43:111017</div>
1018<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:271019<h2 id="_examples">EXAMPLES</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231020<div class="sectionbody">
Junio C Hamano97bcb482010-11-25 03:16:071021<div class="ulist"><ul>
Junio C Hamano6d76d612008-05-09 05:46:081022<li>
Junio C Hamano1a4e8412005-12-27 08:17:231023<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531024Adds content from all <code>*.txt</code> files under <code>Documentation</code> directory
Junio C Hamano6d76d612008-05-09 05:46:081025and its subdirectories:
Junio C Hamano1a4e8412005-12-27 08:17:231026</p>
Junio C Hamano6d76d612008-05-09 05:46:081027<div class="listingblock">
1028<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531029<pre><code>$ git add Documentation/\*.txt</code></pre>
Junio C Hamano6d76d612008-05-09 05:46:081030</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531031<div class="paragraph"><p>Note that the asterisk <code>*</code> is quoted from the shell in this
Junio C Hamanof8a79222009-03-01 08:02:501032example; this lets the command include the files from
Junio C Hamanoc14e6ad2014-10-31 20:25:531033subdirectories of <code>Documentation/</code> directory.</p></div>
Junio C Hamano6d76d612008-05-09 05:46:081034</li>
1035<li>
Junio C Hamano1a4e8412005-12-27 08:17:231036<p>
Junio C Hamano6d76d612008-05-09 05:46:081037Considers adding content from all git-*.sh scripts:
Junio C Hamano1a4e8412005-12-27 08:17:231038</p>
Junio C Hamano6d76d612008-05-09 05:46:081039<div class="listingblock">
1040<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531041<pre><code>$ git add git-*.sh</code></pre>
Junio C Hamano6d76d612008-05-09 05:46:081042</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071043<div class="paragraph"><p>Because this example lets the shell expand the asterisk (i.e. you are
Junio C Hamano6d76d612008-05-09 05:46:081044listing the files explicitly), it does not consider
Junio C Hamanoc14e6ad2014-10-31 20:25:531045<code>subdir/git-foo.sh</code>.</p></div>
Junio C Hamano6d76d612008-05-09 05:46:081046</li>
Junio C Hamano46a38aa2008-07-14 03:13:271047</ul></div>
Junio C Hamano1a4e8412005-12-27 08:17:231048</div>
Junio C Hamano9d971152012-12-19 00:43:111049</div>
1050<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:271051<h2 id="_interactive_mode">Interactive mode</h2>
Junio C Hamano17bbaca2006-12-25 11:36:311052<div class="sectionbody">
Junio C Hamano97bcb482010-11-25 03:16:071053<div class="paragraph"><p>When the command enters the interactive mode, it shows the
Junio C Hamanof9771f62007-01-17 17:42:301054output of the <em>status</em> subcommand, and then goes into its
Junio C Hamano46a38aa2008-07-14 03:13:271055interactive command loop.</p></div>
Junio C Hamano97bcb482010-11-25 03:16:071056<div class="paragraph"><p>The command loop shows the list of subcommands available, and
Junio C Hamano17bbaca2006-12-25 11:36:311057gives a prompt "What now&gt; ". In general, when the prompt ends
1058with a single <em>&gt;</em>, you can pick only one of the choices given
Junio C Hamano46a38aa2008-07-14 03:13:271059and type return, like this:</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311060<div class="listingblock">
1061<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531062<pre><code> *** Commands ***
Junio C Hamano17bbaca2006-12-25 11:36:311063 1: status 2: update 3: revert 4: add untracked
1064 5: patch 6: diff 7: quit 8: help
Junio C Hamanoc14e6ad2014-10-31 20:25:531065 What now&gt; 1</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311066</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531067<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:271068choice is unique.</p></div>
Junio C Hamano97bcb482010-11-25 03:16:071069<div class="paragraph"><p>The main command loop has 6 subcommands (plus help and quit).</p></div>
1070<div class="dlist"><dl>
1071<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311072status
1073</dt>
1074<dd>
1075<p>
1076 This shows the change between HEAD and index (i.e. what will be
Junio C Hamanoc14e6ad2014-10-31 20:25:531077 committed if you say <code>git commit</code>), and between index and
Junio C Hamano17bbaca2006-12-25 11:36:311078 working tree files (i.e. what you could stage further before
Junio C Hamanoc14e6ad2014-10-31 20:25:531079 <code>git commit</code> using <code>git add</code>) for each path. A sample output
Junio C Hamano17bbaca2006-12-25 11:36:311080 looks like this:
1081</p>
1082<div class="listingblock">
1083<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531084<pre><code> staged unstaged path
Junio C Hamano17bbaca2006-12-25 11:36:311085 1: binary nothing foo.png
Junio C Hamanoc14e6ad2014-10-31 20:25:531086 2: +403/-35 +1/-1 git-add--interactive.perl</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311087</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071088<div class="paragraph"><p>It shows that foo.png has differences from HEAD (but that is
Junio C Hamano17bbaca2006-12-25 11:36:311089binary so line count cannot be shown) and there is no
1090difference between indexed copy and the working tree
1091version (if the working tree version were also different,
1092<em>binary</em> would have been shown in place of <em>nothing</em>). The
Junio C Hamano2db3e752010-09-03 21:33:061093other file, git-add&#45;&#45;interactive.perl, has 403 lines added
Junio C Hamano17bbaca2006-12-25 11:36:311094and 35 lines deleted if you commit what is in the index, but
1095working tree file has further modifications (one addition and
Junio C Hamano46a38aa2008-07-14 03:13:271096one deletion).</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311097</dd>
Junio C Hamano97bcb482010-11-25 03:16:071098<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311099update
1100</dt>
1101<dd>
1102<p>
Junio C Hamanof8a79222009-03-01 08:02:501103 This shows the status information and issues an "Update&gt;&gt;"
1104 prompt. When the prompt ends with double <em>&gt;&gt;</em>, you can
Junio C Hamano17bbaca2006-12-25 11:36:311105 make more than one selection, concatenated with whitespace or
1106 comma. Also you can say ranges. E.g. "2-5 7,9" to choose
Junio C Hamano38ddcce2008-07-15 15:49:031107 2,3,4,5,7,9 from the list. If the second number in a range is
1108 omitted, all remaining patches are taken. E.g. "7-" to choose
1109 7,8,9 from the list. You can say <em>*</em> to choose everything.
Junio C Hamano17bbaca2006-12-25 11:36:311110</p>
Junio C Hamano97bcb482010-11-25 03:16:071111<div class="paragraph"><p>What you chose are then highlighted with <em>*</em>,
Junio C Hamano46a38aa2008-07-14 03:13:271112like this:</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311113<div class="listingblock">
1114<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531115<pre><code> staged unstaged path
Junio C Hamano17bbaca2006-12-25 11:36:311116 1: binary nothing foo.png
Junio C Hamanoc14e6ad2014-10-31 20:25:531117* 2: +403/-35 +1/-1 git-add--interactive.perl</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311118</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531119<div class="paragraph"><p>To remove selection, prefix the input with <code>-</code>
Junio C Hamano46a38aa2008-07-14 03:13:271120like this:</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311121<div class="listingblock">
1122<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531123<pre><code>Update&gt;&gt; -2</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311124</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071125<div class="paragraph"><p>After making the selection, answer with an empty line to stage the
Junio C Hamano46a38aa2008-07-14 03:13:271126contents of working tree files for selected paths in the index.</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311127</dd>
Junio C Hamano97bcb482010-11-25 03:16:071128<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311129revert
1130</dt>
1131<dd>
1132<p>
1133 This has a very similar UI to <em>update</em>, and the staged
1134 information for selected paths are reverted to that of the
1135 HEAD version. Reverting new paths makes them untracked.
1136</p>
1137</dd>
Junio C Hamano97bcb482010-11-25 03:16:071138<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311139add untracked
1140</dt>
1141<dd>
1142<p>
1143 This has a very similar UI to <em>update</em> and
1144 <em>revert</em>, and lets you add untracked paths to the index.
1145</p>
1146</dd>
Junio C Hamano97bcb482010-11-25 03:16:071147<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311148patch
1149</dt>
1150<dd>
1151<p>
Junio C Hamanof8a79222009-03-01 08:02:501152 This lets you choose one path out of a <em>status</em> like selection.
1153 After choosing the path, it presents the diff between the index
Junio C Hamano17bbaca2006-12-25 11:36:311154 and the working tree file and asks you if you want to stage
Junio C Hamano9eb58352011-05-11 20:09:241155 the change of each hunk. You can select one of the following
1156 options and type return:
Junio C Hamano17bbaca2006-12-25 11:36:311157</p>
1158<div class="literalblock">
1159<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531160<pre><code>y - stage this hunk
Junio C Hamano8760ea62008-03-14 08:58:451161n - do not stage this hunk
Junio C Hamanod75148a2014-04-08 19:48:381162q - quit; do not stage this hunk or any of the remaining ones
Junio C Hamanoa574a092010-06-13 19:57:101163a - stage this hunk and all later hunks in the file
Junio C Hamanod75148a2014-04-08 19:48:381164d - do not stage this hunk or any of the later hunks in the file
Junio C Hamano3bd66e92009-04-18 06:17:561165g - select a hunk to go to
1166/ - search for a hunk matching the given regex
Junio C Hamano8760ea62008-03-14 08:58:451167j - leave this hunk undecided, see next undecided hunk
1168J - leave this hunk undecided, see next hunk
1169k - leave this hunk undecided, see previous undecided hunk
1170K - leave this hunk undecided, see previous hunk
Junio C Hamanoe0facb92007-12-05 10:59:481171s - split the current hunk into smaller hunks
Junio C Hamano46a38aa2008-07-14 03:13:271172e - manually edit the current hunk
Junio C Hamanoc14e6ad2014-10-31 20:25:531173? - print help</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311174</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071175<div class="paragraph"><p>After deciding the fate for all hunks, if there is any hunk
Junio C Hamano46a38aa2008-07-14 03:13:271176that was chosen, the index is updated with the selected hunks.</p></div>
Junio C Hamano9eb58352011-05-11 20:09:241177<div class="paragraph"><p>You can omit having to type return here, by setting the configuration
Junio C Hamano322c6242015-03-23 21:32:461178variable <code>interactive.singleKey</code> to <code>true</code>.</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:311181diff
1182</dt>
1183<dd>
1184<p>
1185 This lets you review what will be committed (i.e. between
1186 HEAD and index).
1187</p>
1188</dd>
Junio C Hamano46a38aa2008-07-14 03:13:271189</dl></div>
Junio C Hamano17bbaca2006-12-25 11:36:311190</div>
Junio C Hamano9d971152012-12-19 00:43:111191</div>
1192<div class="sect1">
Junio C Hamano97bcb482010-11-25 03:16:071193<h2 id="_editing_patches">EDITING PATCHES</h2>
1194<div class="sectionbody">
Junio C Hamanoc14e6ad2014-10-31 20:25:531195<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:071196selector will open a patch in your editor; after the editor exits, the
1197result is applied to the index. You are free to make arbitrary changes
1198to the patch, but note that some changes may have confusing results, or
1199even result in a patch that cannot be applied. If you want to abort the
1200operation entirely (i.e., stage nothing new in the index), simply delete
1201all lines of the patch. The list below describes some common things you
1202may see in a patch, and which editing operations make sense on them.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111203<div class="openblock">
1204<div class="content">
Junio C Hamano97bcb482010-11-25 03:16:071205<div class="dlist"><dl>
1206<dt class="hdlist1">
1207added content
1208</dt>
1209<dd>
1210<p>
1211Added content is represented by lines beginning with "&#43;". You can
1212prevent staging any addition lines by deleting them.
1213</p>
1214</dd>
1215<dt class="hdlist1">
1216removed content
1217</dt>
1218<dd>
1219<p>
1220Removed content is represented by lines beginning with "-". You can
1221prevent staging their removal by converting the "-" to a " " (space).
1222</p>
1223</dd>
1224<dt class="hdlist1">
1225modified content
1226</dt>
1227<dd>
1228<p>
1229Modified content is represented by "-" lines (removing the old content)
1230followed by "&#43;" lines (adding the replacement content). You can
1231prevent staging the modification by converting "-" lines to " ", and
1232removing "&#43;" lines. Beware that modifying only half of the pair is
1233likely to introduce confusing changes to the index.
1234</p>
1235</dd>
1236</dl></div>
Junio C Hamano9d971152012-12-19 00:43:111237</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071238<div class="paragraph"><p>There are also more complex operations that can be performed. But beware
1239that because the patch is applied only to the index and not the working
1240tree, the working tree will appear to "undo" the change in the index.
Junio C Hamano7165bf72011-01-04 22:06:181241For example, introducing a new line into the index that is in neither
Junio C Hamano97bcb482010-11-25 03:16:071242the HEAD nor the working tree will stage the new line for commit, but
1243the line will appear to be reverted in the working tree.</p></div>
1244<div class="paragraph"><p>Avoid using these constructs, or do so with extreme caution.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111245<div class="openblock">
1246<div class="content">
Junio C Hamano97bcb482010-11-25 03:16:071247<div class="dlist"><dl>
1248<dt class="hdlist1">
1249removing untouched content
1250</dt>
1251<dd>
1252<p>
1253Content which does not differ between the index and working tree may be
1254shown on context lines, beginning with a " " (space). You can stage
1255context lines for removal by converting the space to a "-". The
1256resulting working tree file will appear to re-add the content.
1257</p>
1258</dd>
1259<dt class="hdlist1">
1260modifying existing content
1261</dt>
1262<dd>
1263<p>
1264One can also modify context lines by staging them for removal (by
1265converting " " to "-") and adding a "&#43;" line with the new content.
1266Similarly, one can modify "&#43;" lines for existing additions or
1267modifications. In all cases, the new modification will appear reverted
1268in the working tree.
1269</p>
1270</dd>
1271<dt class="hdlist1">
1272new content
1273</dt>
1274<dd>
1275<p>
1276You may also add new content that does not exist in the patch; simply
1277add new lines, each starting with "&#43;". The addition will appear
1278reverted in the working tree.
1279</p>
1280</dd>
1281</dl></div>
Junio C Hamano9d971152012-12-19 00:43:111282</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071283<div class="paragraph"><p>There are also several operations which should be avoided entirely, as
1284they will make the patch impossible to apply:</p></div>
1285<div class="ulist"><ul>
1286<li>
1287<p>
1288adding context (" ") or removal ("-") lines
1289</p>
1290</li>
1291<li>
1292<p>
1293deleting context or removal lines
1294</p>
1295</li>
1296<li>
1297<p>
1298modifying the contents of context or removal lines
1299</p>
1300</li>
1301</ul></div>
1302</div>
Junio C Hamano9d971152012-12-19 00:43:111303</div>
1304<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:271305<h2 id="_see_also">SEE ALSO</h2>
Junio C Hamano2bb13102006-03-06 07:10:211306<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:231307<div class="paragraph"><p><a href="git-status.html">git-status(1)</a>
1308<a href="git-rm.html">git-rm(1)</a>
1309<a href="git-reset.html">git-reset(1)</a>
1310<a href="git-mv.html">git-mv(1)</a>
1311<a href="git-commit.html">git-commit(1)</a>
1312<a href="git-update-index.html">git-update-index(1)</a></p></div>
Junio C Hamano2bb13102006-03-06 07:10:211313</div>
Junio C Hamano9d971152012-12-19 00:43:111314</div>
1315<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:271316<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231317<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:231318<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231319</div>
Junio C Hamano7bd050f2011-09-22 06:32:221320</div>
Junio C Hamano9d971152012-12-19 00:43:111321</div>
Junio C Hamano7bd050f2011-09-22 06:32:221322<div id="footnotes"><hr /></div>
Junio C Hamano1a4e8412005-12-27 08:17:231323<div id="footer">
1324<div id="footer-text">
Junio C Hamanoffe10ca2016-02-04 00:44:231325Last updated 2016-02-03 16:43:50 PST
Junio C Hamano1a4e8412005-12-27 08:17:231326</div>
1327</div>
1328</body>
1329</html>