blob: 9b6d7772df362db121d78af41bdf49904f069239 [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" />
6<meta name="generator" content="AsciiDoc 8.6.8" />
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 Hamano9d971152012-12-19 00:43:1190.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}
97
Junio C Hamano9d971152012-12-19 00:43:1198
99#author {
Junio C Hamano1a4e8412005-12-27 08:17:23100 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23101 font-weight: bold;
Junio C Hamano46a38aa2008-07-14 03:13:27102 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23103}
Junio C Hamano9d971152012-12-19 00:43:11104#email {
Junio C Hamano1a4e8412005-12-27 08:17:23105}
Junio C Hamano9d971152012-12-19 00:43:11106#revnumber, #revdate, #revremark {
Junio C Hamano1a4e8412005-12-27 08:17:23107}
108
Junio C Hamano9d971152012-12-19 00:43:11109#footer {
Junio C Hamano1a4e8412005-12-27 08:17:23110 font-size: small;
111 border-top: 2px solid silver;
112 padding-top: 0.5em;
113 margin-top: 4.0em;
114}
Junio C Hamano9d971152012-12-19 00:43:11115#footer-text {
Junio C Hamano1a4e8412005-12-27 08:17:23116 float: left;
117 padding-bottom: 0.5em;
118}
Junio C Hamano9d971152012-12-19 00:43:11119#footer-badges {
Junio C Hamano1a4e8412005-12-27 08:17:23120 float: right;
121 padding-bottom: 0.5em;
122}
123
Junio C Hamano9d971152012-12-19 00:43:11124#preamble {
Junio C Hamano97bcb482010-11-25 03:16:07125 margin-top: 1.5em;
126 margin-bottom: 1.5em;
127}
Junio C Hamano9d971152012-12-19 00:43:11128div.imageblock, div.exampleblock, div.verseblock,
Junio C Hamano1a4e8412005-12-27 08:17:23129div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
130div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22131 margin-top: 1.0em;
Junio C Hamano1a4e8412005-12-27 08:17:23132 margin-bottom: 1.5em;
133}
134div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22135 margin-top: 2.0em;
136 margin-bottom: 2.0em;
137 margin-right: 10%;
138 color: #606060;
Junio C Hamano1a4e8412005-12-27 08:17:23139}
140
141div.content { /* Block element content. */
142 padding: 0;
143}
144
145/* Block element titles. */
146div.title, caption.title {
Junio C Hamano97bcb482010-11-25 03:16:07147 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23148 font-weight: bold;
149 text-align: left;
150 margin-top: 1.0em;
151 margin-bottom: 0.5em;
152}
153div.title + * {
154 margin-top: 0;
155}
156
157td div.title:first-child {
158 margin-top: 0.0em;
159}
160div.content div.title:first-child {
161 margin-top: 0.0em;
162}
163div.content + div.title {
164 margin-top: 0.0em;
165}
166
167div.sidebarblock > div.content {
168 background: #ffffee;
Junio C Hamano9d971152012-12-19 00:43:11169 border: 1px solid #dddddd;
170 border-left: 4px solid #f0f0f0;
Junio C Hamano1a4e8412005-12-27 08:17:23171 padding: 0.5em;
172}
173
174div.listingblock > div.content {
Junio C Hamano9d971152012-12-19 00:43:11175 border: 1px solid #dddddd;
176 border-left: 5px solid #f0f0f0;
177 background: #f8f8f8;
Junio C Hamano1a4e8412005-12-27 08:17:23178 padding: 0.5em;
179}
180
Junio C Hamano7bd050f2011-09-22 06:32:22181div.quoteblock, div.verseblock {
182 padding-left: 1.0em;
183 margin-left: 1.0em;
Junio C Hamano97bcb482010-11-25 03:16:07184 margin-right: 10%;
Junio C Hamano9d971152012-12-19 00:43:11185 border-left: 5px solid #f0f0f0;
186 color: #888;
Junio C Hamano1a4e8412005-12-27 08:17:23187}
Junio C Hamano7bd050f2011-09-22 06:32:22188
Junio C Hamano97bcb482010-11-25 03:16:07189div.quoteblock > div.attribution {
190 padding-top: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23191 text-align: right;
192}
Junio C Hamano97bcb482010-11-25 03:16:07193
Junio C Hamano9d971152012-12-19 00:43:11194div.verseblock > pre.content {
195 font-family: inherit;
196 font-size: inherit;
Junio C Hamano97bcb482010-11-25 03:16:07197}
198div.verseblock > div.attribution {
199 padding-top: 0.75em;
200 text-align: left;
201}
202/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamano46a38aa2008-07-14 03:13:27203div.verseblock + div.attribution {
204 text-align: left;
205}
Junio C Hamano1a4e8412005-12-27 08:17:23206
207div.admonitionblock .icon {
208 vertical-align: top;
209 font-size: 1.1em;
210 font-weight: bold;
211 text-decoration: underline;
212 color: #527bbd;
213 padding-right: 0.5em;
214}
215div.admonitionblock td.content {
216 padding-left: 0.5em;
Junio C Hamano7bd050f2011-09-22 06:32:22217 border-left: 3px solid #dddddd;
Junio C Hamano1a4e8412005-12-27 08:17:23218}
219
220div.exampleblock > div.content {
Junio C Hamano7bd050f2011-09-22 06:32:22221 border-left: 3px solid #dddddd;
222 padding-left: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23223}
224
Junio C Hamano1a4e8412005-12-27 08:17:23225div.imageblock div.content { padding-left: 0; }
Junio C Hamano1a4e8412005-12-27 08:17:23226span.image img { border-style: none; }
Junio C Hamano97bcb482010-11-25 03:16:07227a.image:visited { color: white; }
Junio C Hamano1a4e8412005-12-27 08:17:23228
229dl {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
232}
233dt {
234 margin-top: 0.5em;
235 margin-bottom: 0;
Junio C Hamano97bcb482010-11-25 03:16:07236 font-style: normal;
237 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23238}
239dd > *:first-child {
Junio C Hamano97bcb482010-11-25 03:16:07240 margin-top: 0.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23241}
242
243ul, ol {
244 list-style-position: outside;
245}
Junio C Hamano97bcb482010-11-25 03:16:07246ol.arabic {
247 list-style-type: decimal;
248}
249ol.loweralpha {
Junio C Hamano1a4e8412005-12-27 08:17:23250 list-style-type: lower-alpha;
251}
Junio C Hamano97bcb482010-11-25 03:16:07252ol.upperalpha {
253 list-style-type: upper-alpha;
254}
255ol.lowerroman {
256 list-style-type: lower-roman;
257}
258ol.upperroman {
259 list-style-type: upper-roman;
260}
261
262div.compact ul, div.compact ol,
263div.compact p, div.compact p,
264div.compact div, div.compact div {
265 margin-top: 0.1em;
266 margin-bottom: 0.1em;
267}
Junio C Hamano1a4e8412005-12-27 08:17:23268
Junio C Hamano1a4e8412005-12-27 08:17:23269tfoot {
270 font-weight: bold;
271}
Junio C Hamano97bcb482010-11-25 03:16:07272td > div.verse {
273 white-space: pre;
274}
Junio C Hamano97bcb482010-11-25 03:16:07275
276div.hdlist {
Junio C Hamano1a4e8412005-12-27 08:17:23277 margin-top: 0.8em;
278 margin-bottom: 0.8em;
279}
Junio C Hamano97bcb482010-11-25 03:16:07280div.hdlist tr {
281 padding-bottom: 15px;
Junio C Hamano46a38aa2008-07-14 03:13:27282}
Junio C Hamano97bcb482010-11-25 03:16:07283dt.hdlist1.strong, td.hdlist1.strong {
284 font-weight: bold;
285}
286td.hdlist1 {
Junio C Hamano1a4e8412005-12-27 08:17:23287 vertical-align: top;
Junio C Hamano97bcb482010-11-25 03:16:07288 font-style: normal;
Junio C Hamano1a4e8412005-12-27 08:17:23289 padding-right: 0.8em;
Junio C Hamano97bcb482010-11-25 03:16:07290 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23291}
Junio C Hamano97bcb482010-11-25 03:16:07292td.hdlist2 {
Junio C Hamano1a4e8412005-12-27 08:17:23293 vertical-align: top;
294}
Junio C Hamano97bcb482010-11-25 03:16:07295div.hdlist.compact tr {
296 margin: 0;
297 padding-bottom: 0;
298}
299
300.comment {
301 background: yellow;
302}
Junio C Hamano1a4e8412005-12-27 08:17:23303
Junio C Hamano7bd050f2011-09-22 06:32:22304.footnote, .footnoteref {
305 font-size: 0.8em;
306}
307
308span.footnote, span.footnoteref {
309 vertical-align: super;
310}
311
312#footnotes {
313 margin: 20px 0 20px 0;
314 padding: 7px 0 0 0;
315}
316
317#footnotes div.footnote {
318 margin: 0 0 5px 0;
319}
320
321#footnotes hr {
322 border: none;
323 border-top: 1px solid silver;
324 height: 1px;
325 text-align: left;
326 margin-left: 0;
327 width: 20%;
328 min-width: 100px;
329}
330
Junio C Hamano9d971152012-12-19 00:43:11331div.colist td {
332 padding-right: 0.5em;
333 padding-bottom: 0.3em;
334 vertical-align: top;
335}
336div.colist td img {
337 margin-top: 0.3em;
Junio C Hamano1a4e8412005-12-27 08:17:23338}
Junio C Hamano46a38aa2008-07-14 03:13:27339
Junio C Hamano9d971152012-12-19 00:43:11340@media print {
341 #footer-badges { display: none; }
342}
343
344#toc {
Junio C Hamano7bd050f2011-09-22 06:32:22345 margin-bottom: 2.5em;
346}
347
Junio C Hamano9d971152012-12-19 00:43:11348#toctitle {
Junio C Hamano46a38aa2008-07-14 03:13:27349 color: #527bbd;
Junio C Hamano46a38aa2008-07-14 03:13:27350 font-size: 1.1em;
351 font-weight: bold;
352 margin-top: 1.0em;
353 margin-bottom: 0.1em;
354}
355
Junio C Hamano9d971152012-12-19 00:43:11356div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
Junio C Hamano46a38aa2008-07-14 03:13:27357 margin-top: 0;
358 margin-bottom: 0;
359}
360div.toclevel2 {
361 margin-left: 2em;
362 font-size: 0.9em;
363}
364div.toclevel3 {
365 margin-left: 4em;
366 font-size: 0.9em;
367}
368div.toclevel4 {
369 margin-left: 6em;
370 font-size: 0.9em;
371}
Junio C Hamano9d971152012-12-19 00:43:11372
373span.aqua { color: aqua; }
374span.black { color: black; }
375span.blue { color: blue; }
376span.fuchsia { color: fuchsia; }
377span.gray { color: gray; }
378span.green { color: green; }
379span.lime { color: lime; }
380span.maroon { color: maroon; }
381span.navy { color: navy; }
382span.olive { color: olive; }
383span.purple { color: purple; }
384span.red { color: red; }
385span.silver { color: silver; }
386span.teal { color: teal; }
387span.white { color: white; }
388span.yellow { color: yellow; }
389
390span.aqua-background { background: aqua; }
391span.black-background { background: black; }
392span.blue-background { background: blue; }
393span.fuchsia-background { background: fuchsia; }
394span.gray-background { background: gray; }
395span.green-background { background: green; }
396span.lime-background { background: lime; }
397span.maroon-background { background: maroon; }
398span.navy-background { background: navy; }
399span.olive-background { background: olive; }
400span.purple-background { background: purple; }
401span.red-background { background: red; }
402span.silver-background { background: silver; }
403span.teal-background { background: teal; }
404span.white-background { background: white; }
405span.yellow-background { background: yellow; }
406
407span.big { font-size: 2em; }
408span.small { font-size: 0.6em; }
409
410span.underline { text-decoration: underline; }
411span.overline { text-decoration: overline; }
412span.line-through { text-decoration: line-through; }
413
414div.unbreakable { page-break-inside: avoid; }
415
416
417/*
418 * xhtml11 specific
419 *
420 * */
421
422div.tableblock {
423 margin-top: 1.0em;
424 margin-bottom: 1.5em;
425}
426div.tableblock > table {
427 border: 3px solid #527bbd;
428}
429thead, p.table.header {
430 font-weight: bold;
431 color: #527bbd;
432}
433p.table {
434 margin-top: 0;
435}
436/* Because the table frame attribute is overriden by CSS in most browsers. */
437div.tableblock > table[frame="void"] {
438 border-style: none;
439}
440div.tableblock > table[frame="hsides"] {
441 border-left-style: none;
442 border-right-style: none;
443}
444div.tableblock > table[frame="vsides"] {
445 border-top-style: none;
446 border-bottom-style: none;
447}
448
449
450/*
451 * html5 specific
452 *
453 * */
454
455table.tableblock {
456 margin-top: 1.0em;
457 margin-bottom: 1.5em;
458}
459thead, p.tableblock.header {
460 font-weight: bold;
461 color: #527bbd;
462}
463p.tableblock {
464 margin-top: 0;
465}
466table.tableblock {
467 border-width: 3px;
468 border-spacing: 0px;
469 border-style: solid;
470 border-color: #527bbd;
471 border-collapse: collapse;
472}
473th.tableblock, td.tableblock {
474 border-width: 1px;
475 padding: 4px;
476 border-style: solid;
477 border-color: #527bbd;
478}
479
480table.tableblock.frame-topbot {
481 border-left-style: hidden;
482 border-right-style: hidden;
483}
484table.tableblock.frame-sides {
485 border-top-style: hidden;
486 border-bottom-style: hidden;
487}
488table.tableblock.frame-none {
489 border-style: hidden;
490}
491
492th.tableblock.halign-left, td.tableblock.halign-left {
493 text-align: left;
494}
495th.tableblock.halign-center, td.tableblock.halign-center {
496 text-align: center;
497}
498th.tableblock.halign-right, td.tableblock.halign-right {
499 text-align: right;
500}
501
502th.tableblock.valign-top, td.tableblock.valign-top {
503 vertical-align: top;
504}
505th.tableblock.valign-middle, td.tableblock.valign-middle {
506 vertical-align: middle;
507}
508th.tableblock.valign-bottom, td.tableblock.valign-bottom {
509 vertical-align: bottom;
510}
511
512
513/*
514 * manpage specific
515 *
516 * */
517
518body.manpage h1 {
Junio C Hamano97bcb482010-11-25 03:16:07519 padding-top: 0.5em;
520 padding-bottom: 0.5em;
521 border-top: 2px solid silver;
522 border-bottom: 2px solid silver;
523}
Junio C Hamano9d971152012-12-19 00:43:11524body.manpage h2 {
Junio C Hamano97bcb482010-11-25 03:16:07525 border-style: none;
526}
Junio C Hamano9d971152012-12-19 00:43:11527body.manpage div.sectionbody {
528 margin-left: 3em;
Junio C Hamano97bcb482010-11-25 03:16:07529}
530
531@media print {
Junio C Hamano9d971152012-12-19 00:43:11532 body.manpage div#toc { display: none; }
Junio C Hamano97bcb482010-11-25 03:16:07533}
534
Junio C Hamano1a4e8412005-12-27 08:17:23535
Junio C Hamano1a4e8412005-12-27 08:17:23536</style>
Junio C Hamano7bd050f2011-09-22 06:32:22537<script type="text/javascript">
538/*<![CDATA[*/
Junio C Hamano7bd050f2011-09-22 06:32:22539var asciidoc = { // Namespace.
540
541/////////////////////////////////////////////////////////////////////
542// Table Of Contents generator
543/////////////////////////////////////////////////////////////////////
544
545/* Author: Mihai Bazon, September 2002
546 * http://students.infoiasi.ro/~mishoo
547 *
548 * Table Of Content generator
549 * Version: 0.4
550 *
551 * Feel free to use this script under the terms of the GNU General Public
552 * License, as long as you do not remove or alter this notice.
553 */
554
555 /* modified by Troy D. Hanson, September 2006. License: GPL */
556 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
557
558// toclevels = 1..4.
559toc: function (toclevels) {
560
561 function getText(el) {
562 var text = "";
563 for (var i = el.firstChild; i != null; i = i.nextSibling) {
564 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
565 text += i.data;
566 else if (i.firstChild != null)
567 text += getText(i);
568 }
569 return text;
570 }
571
572 function TocEntry(el, text, toclevel) {
573 this.element = el;
574 this.text = text;
575 this.toclevel = toclevel;
576 }
577
578 function tocEntries(el, toclevels) {
579 var result = new Array;
Junio C Hamano9d971152012-12-19 00:43:11580 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
Junio C Hamano7bd050f2011-09-22 06:32:22581 // Function that scans the DOM tree for header elements (the DOM2
582 // nodeIterator API would be a better technique but not supported by all
583 // browsers).
584 var iterate = function (el) {
585 for (var i = el.firstChild; i != null; i = i.nextSibling) {
586 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
587 var mo = re.exec(i.tagName);
588 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
589 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
590 }
591 iterate(i);
592 }
593 }
594 }
595 iterate(el);
596 return result;
597 }
598
599 var toc = document.getElementById("toc");
Junio C Hamano9d971152012-12-19 00:43:11600 if (!toc) {
601 return;
602 }
603
604 // Delete existing TOC entries in case we're reloading the TOC.
605 var tocEntriesToRemove = [];
606 var i;
607 for (i = 0; i < toc.childNodes.length; i++) {
608 var entry = toc.childNodes[i];
609 if (entry.nodeName.toLowerCase() == 'div'
610 && entry.getAttribute("class")
611 && entry.getAttribute("class").match(/^toclevel/))
612 tocEntriesToRemove.push(entry);
613 }
614 for (i = 0; i < tocEntriesToRemove.length; i++) {
615 toc.removeChild(tocEntriesToRemove[i]);
616 }
617
618 // Rebuild TOC entries.
Junio C Hamano7bd050f2011-09-22 06:32:22619 var entries = tocEntries(document.getElementById("content"), toclevels);
620 for (var i = 0; i < entries.length; ++i) {
621 var entry = entries[i];
622 if (entry.element.id == "")
623 entry.element.id = "_toc_" + i;
624 var a = document.createElement("a");
625 a.href = "#" + entry.element.id;
626 a.appendChild(document.createTextNode(entry.text));
627 var div = document.createElement("div");
628 div.appendChild(a);
629 div.className = "toclevel" + entry.toclevel;
630 toc.appendChild(div);
631 }
632 if (entries.length == 0)
633 toc.parentNode.removeChild(toc);
634},
635
636
637/////////////////////////////////////////////////////////////////////
638// Footnotes generator
639/////////////////////////////////////////////////////////////////////
640
641/* Based on footnote generation code from:
642 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
643 */
644
645footnotes: function () {
Junio C Hamano9d971152012-12-19 00:43:11646 // Delete existing footnote entries in case we're reloading the footnodes.
647 var i;
Junio C Hamano7bd050f2011-09-22 06:32:22648 var noteholder = document.getElementById("footnotes");
Junio C Hamano9d971152012-12-19 00:43:11649 if (!noteholder) {
650 return;
651 }
652 var entriesToRemove = [];
653 for (i = 0; i < noteholder.childNodes.length; i++) {
654 var entry = noteholder.childNodes[i];
655 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
656 entriesToRemove.push(entry);
657 }
658 for (i = 0; i < entriesToRemove.length; i++) {
659 noteholder.removeChild(entriesToRemove[i]);
660 }
661
662 // Rebuild footnote entries.
663 var cont = document.getElementById("content");
Junio C Hamano7bd050f2011-09-22 06:32:22664 var spans = cont.getElementsByTagName("span");
665 var refs = {};
666 var n = 0;
667 for (i=0; i<spans.length; i++) {
668 if (spans[i].className == "footnote") {
669 n++;
Junio C Hamano9d971152012-12-19 00:43:11670 var note = spans[i].getAttribute("data-note");
671 if (!note) {
672 // Use [\s\S] in place of . so multi-line matches work.
673 // Because JavaScript has no s (dotall) regex flag.
674 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
675 spans[i].innerHTML =
676 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
677 "' title='View footnote' class='footnote'>" + n + "</a>]";
678 spans[i].setAttribute("data-note", note);
679 }
Junio C Hamano7bd050f2011-09-22 06:32:22680 noteholder.innerHTML +=
681 "<div class='footnote' id='_footnote_" + n + "'>" +
682 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
683 n + "</a>. " + note + "</div>";
Junio C Hamano7bd050f2011-09-22 06:32:22684 var id =spans[i].getAttribute("id");
685 if (id != null) refs["#"+id] = n;
686 }
687 }
688 if (n == 0)
689 noteholder.parentNode.removeChild(noteholder);
690 else {
691 // Process footnoterefs.
692 for (i=0; i<spans.length; i++) {
693 if (spans[i].className == "footnoteref") {
694 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
695 href = href.match(/#.*/)[0]; // Because IE return full URL.
696 n = refs[href];
697 spans[i].innerHTML =
698 "[<a href='#_footnote_" + n +
699 "' title='View footnote' class='footnote'>" + n + "</a>]";
700 }
701 }
702 }
Junio C Hamano9d971152012-12-19 00:43:11703},
704
705install: function(toclevels) {
706 var timerId;
707
708 function reinstall() {
709 asciidoc.footnotes();
710 if (toclevels) {
711 asciidoc.toc(toclevels);
712 }
713 }
714
715 function reinstallAndRemoveTimer() {
716 clearInterval(timerId);
717 reinstall();
718 }
719
720 timerId = setInterval(reinstall, 500);
721 if (document.addEventListener)
722 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
723 else
724 window.onload = reinstallAndRemoveTimer;
Junio C Hamano7bd050f2011-09-22 06:32:22725}
726
727}
Junio C Hamano9d971152012-12-19 00:43:11728asciidoc.install();
Junio C Hamano7bd050f2011-09-22 06:32:22729/*]]>*/
730</script>
Junio C Hamano1a4e8412005-12-27 08:17:23731</head>
Junio C Hamano9d971152012-12-19 00:43:11732<body class="manpage">
Junio C Hamano1a4e8412005-12-27 08:17:23733<div id="header">
734<h1>
735git-add(1) Manual Page
736</h1>
737<h2>NAME</h2>
738<div class="sectionbody">
739<p>git-add -
Junio C Hamano4cd1c0e2007-08-06 04:39:14740 Add file contents to the index
Junio C Hamano1a4e8412005-12-27 08:17:23741</p>
742</div>
743</div>
Junio C Hamano7bd050f2011-09-22 06:32:22744<div id="content">
Junio C Hamano9d971152012-12-19 00:43:11745<div class="sect1">
Junio C Hamano97bcb482010-11-25 03:16:07746<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23747<div class="sectionbody">
Junio C Hamano8b8b0f22007-08-26 22:10:26748<div class="verseblock">
Junio C Hamano9d971152012-12-19 00:43:11749<pre class="content"><em>git add</em> [-n] [-v] [--force | -f] [--interactive | -i] [--patch | -p]
Junio C Hamanof26c77e2013-04-27 00:06:04750 [--edit | -e] [--[no-]all | --[no-]ignore-removal | [--update | -u]]
751 [--intent-to-add | -N] [--refresh] [--ignore-errors] [--ignore-missing]
752 [--] [&lt;pathspec&gt;&#8230;]</pre>
Junio C Hamano9d971152012-12-19 00:43:11753<div class="attribution">
Junio C Hamano97bcb482010-11-25 03:16:07754</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23755</div>
Junio C Hamano9d971152012-12-19 00:43:11756</div>
757<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:27758<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23759<div class="sectionbody">
Junio C Hamano97bcb482010-11-25 03:16:07760<div class="paragraph"><p>This command updates the index using the current content found in
Junio C Hamanoae05fee2010-01-08 07:39:46761the working tree, to prepare the content staged for the next commit.
762It typically adds the current content of existing paths as a whole,
763but with some options it can also be used to add content with
764only part of the changes made to the working tree files applied, or
765remove paths that do not exist in the working tree anymore.</p></div>
Junio C Hamano97bcb482010-11-25 03:16:07766<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:14767is this snapshot that is taken as the contents of the next commit. Thus
768after making any changes to the working directory, and before running
Junio C Hamano9d971152012-12-19 00:43:11769the commit command, you must use the <code>add</code> command to add any new or
Junio C Hamano46a38aa2008-07-14 03:13:27770modified files to the index.</p></div>
Junio C Hamano97bcb482010-11-25 03:16:07771<div class="paragraph"><p>This command can be performed multiple times before a commit. It only
Junio C Hamano4cd1c0e2007-08-06 04:39:14772adds the content of the specified file(s) at the time the add command is
773run; if you want subsequent changes included in the next commit, then
Junio C Hamano9d971152012-12-19 00:43:11774you must run <code>git add</code> again to add the new content to the index.</p></div>
775<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:27776files have changes that are staged for the next commit.</p></div>
Junio C Hamano9d971152012-12-19 00:43:11777<div class="paragraph"><p>The <code>git add</code> command will not add ignored files by default. If any
778ignored files were explicitly specified on the command line, <code>git add</code>
Junio C Hamano3c1f2c72007-08-17 07:48:05779will fail with a list of ignored files. Ignored files reached by
Junio C Hamano7d9e9bd2007-08-29 07:31:47780directory recursion or filename globbing performed by Git (quote your
Junio C Hamano1aa40d22010-01-21 17:46:43781globs before the shell) will be silently ignored. The <em>git add</em> command can
Junio C Hamano9d971152012-12-19 00:43:11782be used to add ignored files with the <code>-f</code> (force) option.</p></div>
Junio C Hamanoa28a9202012-06-21 07:08:23783<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:27784commit.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23785</div>
Junio C Hamano9d971152012-12-19 00:43:11786</div>
787<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:27788<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23789<div class="sectionbody">
Junio C Hamano97bcb482010-11-25 03:16:07790<div class="dlist"><dl>
791<dt class="hdlist1">
Junio C Hamanobca4cd62013-02-13 00:01:02792&lt;pathspec&gt;&#8230;
Junio C Hamano1a4e8412005-12-27 08:17:23793</dt>
794<dd>
795<p>
Junio C Hamano9d971152012-12-19 00:43:11796 Files to add content from. Fileglobs (e.g. <code>*.c</code>) can
Junio C Hamano3d2adc72006-12-26 03:21:45797 be given to add all matching files. Also a
Junio C Hamano9d971152012-12-19 00:43:11798 leading directory name (e.g. <code>dir</code> to add <code>dir/file1</code>
799 and <code>dir/file2</code>) can be given to add all files in the
Junio C Hamano3d2adc72006-12-26 03:21:45800 directory, recursively.
Junio C Hamano1a4e8412005-12-27 08:17:23801</p>
802</dd>
Junio C Hamano97bcb482010-11-25 03:16:07803<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47804-n
805</dt>
Junio C Hamano97bcb482010-11-25 03:16:07806<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47807--dry-run
Junio C Hamano1a4e8412005-12-27 08:17:23808</dt>
809<dd>
810<p>
Junio C Hamano97bcb482010-11-25 03:16:07811 Don&#8217;t actually add the file(s), just show if they exist and/or will
Junio C Hamanoafabd322010-07-19 20:26:15812 be ignored.
Junio C Hamano1a4e8412005-12-27 08:17:23813</p>
814</dd>
Junio C Hamano97bcb482010-11-25 03:16:07815<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47816-v
817</dt>
Junio C Hamano97bcb482010-11-25 03:16:07818<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47819--verbose
Junio C Hamano1a4e8412005-12-27 08:17:23820</dt>
821<dd>
822<p>
823 Be verbose.
824</p>
825</dd>
Junio C Hamano97bcb482010-11-25 03:16:07826<dt class="hdlist1">
Junio C Hamano3d2adc72006-12-26 03:21:45827-f
828</dt>
Junio C Hamano97bcb482010-11-25 03:16:07829<dt class="hdlist1">
Junio C Hamano00e884a2008-06-15 05:10:38830--force
831</dt>
Junio C Hamano3d2adc72006-12-26 03:21:45832<dd>
833<p>
834 Allow adding otherwise ignored files.
835</p>
836</dd>
Junio C Hamano97bcb482010-11-25 03:16:07837<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47838-i
839</dt>
Junio C Hamano97bcb482010-11-25 03:16:07840<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47841--interactive
Junio C Hamano17bbaca2006-12-25 11:36:31842</dt>
843<dd>
844<p>
845 Add modified contents in the working tree interactively to
Junio C Hamanoe0facb92007-12-05 10:59:48846 the index. Optional path arguments may be supplied to limit
847 operation to a subset of the working tree. See &#8220;Interactive
848 mode&#8221; for details.
Junio C Hamano17bbaca2006-12-25 11:36:31849</p>
850</dd>
Junio C Hamano97bcb482010-11-25 03:16:07851<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47852-p
853</dt>
Junio C Hamano97bcb482010-11-25 03:16:07854<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47855--patch
Junio C Hamano8d1e4712007-12-11 08:54:21856</dt>
857<dd>
858<p>
Junio C Hamano7df6dcf2009-09-13 09:51:17859 Interactively choose hunks of patch between the index and the
860 work tree and add them to the index. This gives the user a chance
861 to review the difference before adding modified contents to the
862 index.
Junio C Hamano8d1e4712007-12-11 08:54:21863</p>
Junio C Hamano9d971152012-12-19 00:43:11864<div class="paragraph"><p>This effectively runs <code>add --interactive</code>, but bypasses the
865initial command menu and directly jumps to the <code>patch</code> subcommand.
Junio C Hamanoe1b26832009-11-15 10:02:56866See &#8220;Interactive mode&#8221; for details.</p></div>
Junio C Hamano8d1e4712007-12-11 08:54:21867</dd>
Junio C Hamano97bcb482010-11-25 03:16:07868<dt class="hdlist1">
Junio C Hamano52ba2952009-05-18 17:43:02869-e, --edit
870</dt>
871<dd>
872<p>
873 Open the diff vs. the index in an editor and let the user
874 edit it. After the editor was closed, adjust the hunk headers
875 and apply the patch to the index.
876</p>
Junio C Hamano97bcb482010-11-25 03:16:07877<div class="paragraph"><p>The intent of this option is to pick and choose lines of the patch to
878apply, or even to modify the contents of lines to be staged. This can be
879quicker and more flexible than using the interactive hunk selector.
880However, it is easy to confuse oneself and create a patch that does not
881apply to the index. See EDITING PATCHES below.</p></div>
Junio C Hamano52ba2952009-05-18 17:43:02882</dd>
Junio C Hamano97bcb482010-11-25 03:16:07883<dt class="hdlist1">
Junio C Hamano3d30fd52007-05-08 00:32:53884-u
885</dt>
Junio C Hamano97bcb482010-11-25 03:16:07886<dt class="hdlist1">
Junio C Hamano00e884a2008-06-15 05:10:38887--update
888</dt>
Junio C Hamano3d30fd52007-05-08 00:32:53889<dd>
890<p>
Junio C Hamanof66c4632013-03-11 20:54:25891 Update the index just where it already has an entry matching
892 &lt;pathspec&gt;. This removes as well as modifies index entries to
893 match the working tree, but adds no new files.
Junio C Hamano3d30fd52007-05-08 00:32:53894</p>
Junio C Hamanobca4cd62013-02-13 00:01:02895<div class="paragraph"><p>If no &lt;pathspec&gt; is given, the current version of Git defaults to
Junio C Hamano3f2ed6f2013-02-04 19:24:09896"."; in other words, update all tracked files in the current directory
897and its subdirectories. This default will change in a future version
Junio C Hamano0292db32013-02-15 23:23:28898of Git, hence the form without &lt;pathspec&gt; should not be used.</p></div>
Junio C Hamano3d30fd52007-05-08 00:32:53899</dd>
Junio C Hamano97bcb482010-11-25 03:16:07900<dt class="hdlist1">
Junio C Hamano5ba2c222008-07-21 04:33:46901-A
902</dt>
Junio C Hamano97bcb482010-11-25 03:16:07903<dt class="hdlist1">
Junio C Hamano5ba2c222008-07-21 04:33:46904--all
905</dt>
Junio C Hamanof26c77e2013-04-27 00:06:04906<dt class="hdlist1">
907--no-ignore-removal
908</dt>
Junio C Hamano5ba2c222008-07-21 04:33:46909<dd>
910<p>
Junio C Hamanof66c4632013-03-11 20:54:25911 Update the index not only where the working tree has a file
912 matching &lt;pathspec&gt; but also where the index already has an
913 entry. This adds, modifies, and removes index entries to
914 match the working tree.
Junio C Hamano5ba2c222008-07-21 04:33:46915</p>
Junio C Hamanof66c4632013-03-11 20:54:25916<div class="paragraph"><p>If no &lt;pathspec&gt; is given, the current version of Git defaults to
917"."; in other words, update all files in the current directory
918and its subdirectories. This default will change in a future version
919of Git, hence the form without &lt;pathspec&gt; should not be used.</p></div>
Junio C Hamano5ba2c222008-07-21 04:33:46920</dd>
Junio C Hamano97bcb482010-11-25 03:16:07921<dt class="hdlist1">
Junio C Hamanoc79bc672013-04-22 19:12:47922--no-all
923</dt>
Junio C Hamanof26c77e2013-04-27 00:06:04924<dt class="hdlist1">
925--ignore-removal
926</dt>
Junio C Hamanoc79bc672013-04-22 19:12:47927<dd>
928<p>
929 Update the index by adding new files that are unknown to the
930 index and files modified in the working tree, but ignore
931 files that have been removed from the working tree. This
932 option is a no-op when no &lt;pathspec&gt; is used.
933</p>
934<div class="paragraph"><p>This option is primarily to help the current users of Git, whose
935"git add &lt;pathspec&gt;&#8230;" ignores removed files. In future versions
936of Git, "git add &lt;pathspec&gt;&#8230;" will be a synonym to "git add -A
Junio C Hamanof26c77e2013-04-27 00:06:04937&lt;pathspec&gt;&#8230;" and "git add --ignore-removal &lt;pathspec&gt;&#8230;" will behave like
Junio C Hamanoc79bc672013-04-22 19:12:47938today&#8217;s "git add &lt;pathspec&gt;&#8230;", ignoring removed files.</p></div>
939</dd>
940<dt class="hdlist1">
Junio C Hamano845880c2008-10-21 19:04:45941-N
942</dt>
Junio C Hamano97bcb482010-11-25 03:16:07943<dt class="hdlist1">
Junio C Hamano845880c2008-10-21 19:04:45944--intent-to-add
945</dt>
946<dd>
947<p>
948 Record only the fact that the path will be added later. An entry
949 for the path is placed in the index with no content. This is
950 useful for, among other things, showing the unstaged content of
Junio C Hamano9d971152012-12-19 00:43:11951 such files with <code>git diff</code> and committing them with <code>git commit
952 -a</code>.
Junio C Hamano845880c2008-10-21 19:04:45953</p>
954</dd>
Junio C Hamano97bcb482010-11-25 03:16:07955<dt class="hdlist1">
Junio C Hamano024b6c62007-08-14 09:43:08956--refresh
957</dt>
958<dd>
959<p>
Junio C Hamano97bcb482010-11-25 03:16:07960 Don&#8217;t add the file(s), but only refresh their stat()
Junio C Hamano024b6c62007-08-14 09:43:08961 information in the index.
962</p>
963</dd>
Junio C Hamano97bcb482010-11-25 03:16:07964<dt class="hdlist1">
Junio C Hamanofeeb1be2008-05-22 00:53:35965--ignore-errors
966</dt>
967<dd>
968<p>
969 If some files could not be added because of errors indexing
970 them, do not abort the operation, but continue adding the
971 others. The command shall still exit with non-zero status.
Junio C Hamano9d971152012-12-19 00:43:11972 The configuration variable <code>add.ignoreErrors</code> can be set to
Junio C Hamanob77f8192011-05-05 01:30:38973 true to make this the default behaviour.
Junio C Hamanofeeb1be2008-05-22 00:53:35974</p>
975</dd>
Junio C Hamano97bcb482010-11-25 03:16:07976<dt class="hdlist1">
Junio C Hamanoafabd322010-07-19 20:26:15977--ignore-missing
978</dt>
979<dd>
980<p>
981 This option can only be used together with --dry-run. By using
982 this option the user can check if any of the given files would
983 be ignored, no matter if they are already present in the work
984 tree or not.
985</p>
986</dd>
Junio C Hamano97bcb482010-11-25 03:16:07987<dt class="hdlist1">
Junio C Hamano1bb569e2006-05-05 23:14:25988--
Junio C Hamano7e9f6b72006-02-22 10:44:55989</dt>
990<dd>
991<p>
992 This option can be used to separate command-line options from
993 the list of files, (useful when filenames might be mistaken
994 for command-line options).
995</p>
996</dd>
Junio C Hamano46a38aa2008-07-14 03:13:27997</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:23998</div>
Junio C Hamano9d971152012-12-19 00:43:11999</div>
1000<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:271001<h2 id="_configuration">Configuration</h2>
Junio C Hamano9fbd4f72007-05-18 15:54:371002<div class="sectionbody">
Junio C Hamano9d971152012-12-19 00:43:111003<div class="paragraph"><p>The optional configuration variable <code>core.excludesfile</code> indicates a path to a
Junio C Hamano9fbd4f72007-05-18 15:54:371004file containing patterns of file names to exclude from git-add, similar to
1005$GIT_DIR/info/exclude. Patterns in the exclude file are used in addition to
Junio C Hamano4f07aec2012-09-25 19:08:441006those in info/exclude. See <a href="gitignore.html">gitignore(5)</a>.</p></div>
Junio C Hamano9fbd4f72007-05-18 15:54:371007</div>
Junio C Hamano9d971152012-12-19 00:43:111008</div>
1009<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:271010<h2 id="_examples">EXAMPLES</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231011<div class="sectionbody">
Junio C Hamano97bcb482010-11-25 03:16:071012<div class="ulist"><ul>
Junio C Hamano6d76d612008-05-09 05:46:081013<li>
Junio C Hamano1a4e8412005-12-27 08:17:231014<p>
Junio C Hamano9d971152012-12-19 00:43:111015Adds content from all <code>*.txt</code> files under <code>Documentation</code> directory
Junio C Hamano6d76d612008-05-09 05:46:081016and its subdirectories:
Junio C Hamano1a4e8412005-12-27 08:17:231017</p>
Junio C Hamano6d76d612008-05-09 05:46:081018<div class="listingblock">
1019<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111020<pre><code>$ git add Documentation/\*.txt</code></pre>
Junio C Hamano6d76d612008-05-09 05:46:081021</div></div>
Junio C Hamano9d971152012-12-19 00:43:111022<div class="paragraph"><p>Note that the asterisk <code>*</code> is quoted from the shell in this
Junio C Hamanof8a79222009-03-01 08:02:501023example; this lets the command include the files from
Junio C Hamano9d971152012-12-19 00:43:111024subdirectories of <code>Documentation/</code> directory.</p></div>
Junio C Hamano6d76d612008-05-09 05:46:081025</li>
1026<li>
Junio C Hamano1a4e8412005-12-27 08:17:231027<p>
Junio C Hamano6d76d612008-05-09 05:46:081028Considers adding content from all git-*.sh scripts:
Junio C Hamano1a4e8412005-12-27 08:17:231029</p>
Junio C Hamano6d76d612008-05-09 05:46:081030<div class="listingblock">
1031<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111032<pre><code>$ git add git-*.sh</code></pre>
Junio C Hamano6d76d612008-05-09 05:46:081033</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071034<div class="paragraph"><p>Because this example lets the shell expand the asterisk (i.e. you are
Junio C Hamano6d76d612008-05-09 05:46:081035listing the files explicitly), it does not consider
Junio C Hamano9d971152012-12-19 00:43:111036<code>subdir/git-foo.sh</code>.</p></div>
Junio C Hamano6d76d612008-05-09 05:46:081037</li>
Junio C Hamano46a38aa2008-07-14 03:13:271038</ul></div>
Junio C Hamano1a4e8412005-12-27 08:17:231039</div>
Junio C Hamano9d971152012-12-19 00:43:111040</div>
1041<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:271042<h2 id="_interactive_mode">Interactive mode</h2>
Junio C Hamano17bbaca2006-12-25 11:36:311043<div class="sectionbody">
Junio C Hamano97bcb482010-11-25 03:16:071044<div class="paragraph"><p>When the command enters the interactive mode, it shows the
Junio C Hamanof9771f62007-01-17 17:42:301045output of the <em>status</em> subcommand, and then goes into its
Junio C Hamano46a38aa2008-07-14 03:13:271046interactive command loop.</p></div>
Junio C Hamano97bcb482010-11-25 03:16:071047<div class="paragraph"><p>The command loop shows the list of subcommands available, and
Junio C Hamano17bbaca2006-12-25 11:36:311048gives a prompt "What now&gt; ". In general, when the prompt ends
1049with a single <em>&gt;</em>, you can pick only one of the choices given
Junio C Hamano46a38aa2008-07-14 03:13:271050and type return, like this:</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311051<div class="listingblock">
1052<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111053<pre><code> *** Commands ***
Junio C Hamano17bbaca2006-12-25 11:36:311054 1: status 2: update 3: revert 4: add untracked
1055 5: patch 6: diff 7: quit 8: help
Junio C Hamano9d971152012-12-19 00:43:111056 What now&gt; 1</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311057</div></div>
Junio C Hamano9d971152012-12-19 00:43:111058<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:271059choice is unique.</p></div>
Junio C Hamano97bcb482010-11-25 03:16:071060<div class="paragraph"><p>The main command loop has 6 subcommands (plus help and quit).</p></div>
1061<div class="dlist"><dl>
1062<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311063status
1064</dt>
1065<dd>
1066<p>
1067 This shows the change between HEAD and index (i.e. what will be
Junio C Hamano9d971152012-12-19 00:43:111068 committed if you say <code>git commit</code>), and between index and
Junio C Hamano17bbaca2006-12-25 11:36:311069 working tree files (i.e. what you could stage further before
Junio C Hamano9d971152012-12-19 00:43:111070 <code>git commit</code> using <code>git add</code>) for each path. A sample output
Junio C Hamano17bbaca2006-12-25 11:36:311071 looks like this:
1072</p>
1073<div class="listingblock">
1074<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111075<pre><code> staged unstaged path
Junio C Hamano17bbaca2006-12-25 11:36:311076 1: binary nothing foo.png
Junio C Hamano9d971152012-12-19 00:43:111077 2: +403/-35 +1/-1 git-add--interactive.perl</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311078</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071079<div class="paragraph"><p>It shows that foo.png has differences from HEAD (but that is
Junio C Hamano17bbaca2006-12-25 11:36:311080binary so line count cannot be shown) and there is no
1081difference between indexed copy and the working tree
1082version (if the working tree version were also different,
1083<em>binary</em> would have been shown in place of <em>nothing</em>). The
Junio C Hamano2db3e752010-09-03 21:33:061084other file, git-add&#45;&#45;interactive.perl, has 403 lines added
Junio C Hamano17bbaca2006-12-25 11:36:311085and 35 lines deleted if you commit what is in the index, but
1086working tree file has further modifications (one addition and
Junio C Hamano46a38aa2008-07-14 03:13:271087one deletion).</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311088</dd>
Junio C Hamano97bcb482010-11-25 03:16:071089<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311090update
1091</dt>
1092<dd>
1093<p>
Junio C Hamanof8a79222009-03-01 08:02:501094 This shows the status information and issues an "Update&gt;&gt;"
1095 prompt. When the prompt ends with double <em>&gt;&gt;</em>, you can
Junio C Hamano17bbaca2006-12-25 11:36:311096 make more than one selection, concatenated with whitespace or
1097 comma. Also you can say ranges. E.g. "2-5 7,9" to choose
Junio C Hamano38ddcce2008-07-15 15:49:031098 2,3,4,5,7,9 from the list. If the second number in a range is
1099 omitted, all remaining patches are taken. E.g. "7-" to choose
1100 7,8,9 from the list. You can say <em>*</em> to choose everything.
Junio C Hamano17bbaca2006-12-25 11:36:311101</p>
Junio C Hamano97bcb482010-11-25 03:16:071102<div class="paragraph"><p>What you chose are then highlighted with <em>*</em>,
Junio C Hamano46a38aa2008-07-14 03:13:271103like this:</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311104<div class="listingblock">
1105<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111106<pre><code> staged unstaged path
Junio C Hamano17bbaca2006-12-25 11:36:311107 1: binary nothing foo.png
Junio C Hamano9d971152012-12-19 00:43:111108* 2: +403/-35 +1/-1 git-add--interactive.perl</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311109</div></div>
Junio C Hamano9d971152012-12-19 00:43:111110<div class="paragraph"><p>To remove selection, prefix the input with <code>-</code>
Junio C Hamano46a38aa2008-07-14 03:13:271111like this:</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311112<div class="listingblock">
1113<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111114<pre><code>Update&gt;&gt; -2</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311115</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071116<div class="paragraph"><p>After making the selection, answer with an empty line to stage the
Junio C Hamano46a38aa2008-07-14 03:13:271117contents of working tree files for selected paths in the index.</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311118</dd>
Junio C Hamano97bcb482010-11-25 03:16:071119<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311120revert
1121</dt>
1122<dd>
1123<p>
1124 This has a very similar UI to <em>update</em>, and the staged
1125 information for selected paths are reverted to that of the
1126 HEAD version. Reverting new paths makes them untracked.
1127</p>
1128</dd>
Junio C Hamano97bcb482010-11-25 03:16:071129<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311130add untracked
1131</dt>
1132<dd>
1133<p>
1134 This has a very similar UI to <em>update</em> and
1135 <em>revert</em>, and lets you add untracked paths to the index.
1136</p>
1137</dd>
Junio C Hamano97bcb482010-11-25 03:16:071138<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311139patch
1140</dt>
1141<dd>
1142<p>
Junio C Hamanof8a79222009-03-01 08:02:501143 This lets you choose one path out of a <em>status</em> like selection.
1144 After choosing the path, it presents the diff between the index
Junio C Hamano17bbaca2006-12-25 11:36:311145 and the working tree file and asks you if you want to stage
Junio C Hamano9eb58352011-05-11 20:09:241146 the change of each hunk. You can select one of the following
1147 options and type return:
Junio C Hamano17bbaca2006-12-25 11:36:311148</p>
1149<div class="literalblock">
1150<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111151<pre><code>y - stage this hunk
Junio C Hamano8760ea62008-03-14 08:58:451152n - do not stage this hunk
Junio C Hamanoa574a092010-06-13 19:57:101153q - quit; do not stage this hunk nor any of the remaining ones
1154a - stage this hunk and all later hunks in the file
1155d - do not stage this hunk nor any of the later hunks in the file
Junio C Hamano3bd66e92009-04-18 06:17:561156g - select a hunk to go to
1157/ - search for a hunk matching the given regex
Junio C Hamano8760ea62008-03-14 08:58:451158j - leave this hunk undecided, see next undecided hunk
1159J - leave this hunk undecided, see next hunk
1160k - leave this hunk undecided, see previous undecided hunk
1161K - leave this hunk undecided, see previous hunk
Junio C Hamanoe0facb92007-12-05 10:59:481162s - split the current hunk into smaller hunks
Junio C Hamano46a38aa2008-07-14 03:13:271163e - manually edit the current hunk
Junio C Hamano9d971152012-12-19 00:43:111164? - print help</code></pre>
Junio C Hamano17bbaca2006-12-25 11:36:311165</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071166<div class="paragraph"><p>After deciding the fate for all hunks, if there is any hunk
Junio C Hamano46a38aa2008-07-14 03:13:271167that was chosen, the index is updated with the selected hunks.</p></div>
Junio C Hamano9eb58352011-05-11 20:09:241168<div class="paragraph"><p>You can omit having to type return here, by setting the configuration
Junio C Hamano9d971152012-12-19 00:43:111169variable <code>interactive.singlekey</code> to <code>true</code>.</p></div>
Junio C Hamano17bbaca2006-12-25 11:36:311170</dd>
Junio C Hamano97bcb482010-11-25 03:16:071171<dt class="hdlist1">
Junio C Hamano17bbaca2006-12-25 11:36:311172diff
1173</dt>
1174<dd>
1175<p>
1176 This lets you review what will be committed (i.e. between
1177 HEAD and index).
1178</p>
1179</dd>
Junio C Hamano46a38aa2008-07-14 03:13:271180</dl></div>
Junio C Hamano17bbaca2006-12-25 11:36:311181</div>
Junio C Hamano9d971152012-12-19 00:43:111182</div>
1183<div class="sect1">
Junio C Hamano97bcb482010-11-25 03:16:071184<h2 id="_editing_patches">EDITING PATCHES</h2>
1185<div class="sectionbody">
Junio C Hamano9d971152012-12-19 00:43:111186<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:071187selector will open a patch in your editor; after the editor exits, the
1188result is applied to the index. You are free to make arbitrary changes
1189to the patch, but note that some changes may have confusing results, or
1190even result in a patch that cannot be applied. If you want to abort the
1191operation entirely (i.e., stage nothing new in the index), simply delete
1192all lines of the patch. The list below describes some common things you
1193may see in a patch, and which editing operations make sense on them.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111194<div class="openblock">
1195<div class="content">
Junio C Hamano97bcb482010-11-25 03:16:071196<div class="dlist"><dl>
1197<dt class="hdlist1">
1198added content
1199</dt>
1200<dd>
1201<p>
1202Added content is represented by lines beginning with "&#43;". You can
1203prevent staging any addition lines by deleting them.
1204</p>
1205</dd>
1206<dt class="hdlist1">
1207removed content
1208</dt>
1209<dd>
1210<p>
1211Removed content is represented by lines beginning with "-". You can
1212prevent staging their removal by converting the "-" to a " " (space).
1213</p>
1214</dd>
1215<dt class="hdlist1">
1216modified content
1217</dt>
1218<dd>
1219<p>
1220Modified content is represented by "-" lines (removing the old content)
1221followed by "&#43;" lines (adding the replacement content). You can
1222prevent staging the modification by converting "-" lines to " ", and
1223removing "&#43;" lines. Beware that modifying only half of the pair is
1224likely to introduce confusing changes to the index.
1225</p>
1226</dd>
1227</dl></div>
Junio C Hamano9d971152012-12-19 00:43:111228</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071229<div class="paragraph"><p>There are also more complex operations that can be performed. But beware
1230that because the patch is applied only to the index and not the working
1231tree, the working tree will appear to "undo" the change in the index.
Junio C Hamano7165bf72011-01-04 22:06:181232For example, introducing a new line into the index that is in neither
Junio C Hamano97bcb482010-11-25 03:16:071233the HEAD nor the working tree will stage the new line for commit, but
1234the line will appear to be reverted in the working tree.</p></div>
1235<div class="paragraph"><p>Avoid using these constructs, or do so with extreme caution.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111236<div class="openblock">
1237<div class="content">
Junio C Hamano97bcb482010-11-25 03:16:071238<div class="dlist"><dl>
1239<dt class="hdlist1">
1240removing untouched content
1241</dt>
1242<dd>
1243<p>
1244Content which does not differ between the index and working tree may be
1245shown on context lines, beginning with a " " (space). You can stage
1246context lines for removal by converting the space to a "-". The
1247resulting working tree file will appear to re-add the content.
1248</p>
1249</dd>
1250<dt class="hdlist1">
1251modifying existing content
1252</dt>
1253<dd>
1254<p>
1255One can also modify context lines by staging them for removal (by
1256converting " " to "-") and adding a "&#43;" line with the new content.
1257Similarly, one can modify "&#43;" lines for existing additions or
1258modifications. In all cases, the new modification will appear reverted
1259in the working tree.
1260</p>
1261</dd>
1262<dt class="hdlist1">
1263new content
1264</dt>
1265<dd>
1266<p>
1267You may also add new content that does not exist in the patch; simply
1268add new lines, each starting with "&#43;". The addition will appear
1269reverted in the working tree.
1270</p>
1271</dd>
1272</dl></div>
Junio C Hamano9d971152012-12-19 00:43:111273</div></div>
Junio C Hamano97bcb482010-11-25 03:16:071274<div class="paragraph"><p>There are also several operations which should be avoided entirely, as
1275they will make the patch impossible to apply:</p></div>
1276<div class="ulist"><ul>
1277<li>
1278<p>
1279adding context (" ") or removal ("-") lines
1280</p>
1281</li>
1282<li>
1283<p>
1284deleting context or removal lines
1285</p>
1286</li>
1287<li>
1288<p>
1289modifying the contents of context or removal lines
1290</p>
1291</li>
1292</ul></div>
1293</div>
Junio C Hamano9d971152012-12-19 00:43:111294</div>
1295<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:271296<h2 id="_see_also">SEE ALSO</h2>
Junio C Hamano2bb13102006-03-06 07:10:211297<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:231298<div class="paragraph"><p><a href="git-status.html">git-status(1)</a>
1299<a href="git-rm.html">git-rm(1)</a>
1300<a href="git-reset.html">git-reset(1)</a>
1301<a href="git-mv.html">git-mv(1)</a>
1302<a href="git-commit.html">git-commit(1)</a>
1303<a href="git-update-index.html">git-update-index(1)</a></p></div>
Junio C Hamano2bb13102006-03-06 07:10:211304</div>
Junio C Hamano9d971152012-12-19 00:43:111305</div>
1306<div class="sect1">
Junio C Hamano46a38aa2008-07-14 03:13:271307<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231308<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:231309<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231310</div>
Junio C Hamano7bd050f2011-09-22 06:32:221311</div>
Junio C Hamano9d971152012-12-19 00:43:111312</div>
Junio C Hamano7bd050f2011-09-22 06:32:221313<div id="footnotes"><hr /></div>
Junio C Hamano1a4e8412005-12-27 08:17:231314<div id="footer">
1315<div id="footer-text">
Junio C Hamano683a8612013-08-23 20:50:091316Last updated 2013-08-20 08:40:27 PDT
Junio C Hamano1a4e8412005-12-27 08:17:231317</div>
1318</div>
1319</body>
1320</html>