Autogenerated HTML docs for v1.4.0-rc1
[git.git] / git.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"\r
2     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\r
4 <head>\r
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\r
6 <meta name="generator" content="AsciiDoc 7.0.2" />\r
7 <style type="text/css">\r
8 /* Debug borders */\r
9 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {\r
10 /*\r
11   border: 1px solid red;\r
12 */\r
13 }\r
14 \r
15 body {\r
16   margin: 1em 5% 1em 5%;\r
17 }\r
18 \r
19 a { color: blue; }\r
20 a:visited { color: fuchsia; }\r
21 \r
22 em {\r
23   font-style: italic;\r
24 }\r
25 \r
26 strong {\r
27   font-weight: bold;\r
28 }\r
29 \r
30 tt {\r
31   color: navy;\r
32 }\r
33 \r
34 h1, h2, h3, h4, h5, h6 {\r
35   color: #527bbd;\r
36   font-family: sans-serif;\r
37   margin-top: 1.2em;\r
38   margin-bottom: 0.5em;\r
39   line-height: 1.3;\r
40 }\r
41 \r
42 h1 {\r
43   border-bottom: 2px solid silver;\r
44 }\r
45 h2 {\r
46   border-bottom: 2px solid silver;\r
47   padding-top: 0.5em;\r
48 }\r
49 \r
50 div.sectionbody {\r
51   font-family: serif;\r
52   margin-left: 0;\r
53 }\r
54 \r
55 hr {\r
56   border: 1px solid silver;\r
57 }\r
58 \r
59 p {\r
60   margin-top: 0.5em;\r
61   margin-bottom: 0.5em;\r
62 }\r
63 \r
64 pre {\r
65   padding: 0;\r
66   margin: 0;\r
67 }\r
68 \r
69 span#author {\r
70   color: #527bbd;\r
71   font-family: sans-serif;\r
72   font-weight: bold;\r
73   font-size: 1.2em;\r
74 }\r
75 span#email {\r
76 }\r
77 span#revision {\r
78   font-family: sans-serif;\r
79 }\r
80 \r
81 div#footer {\r
82   font-family: sans-serif;\r
83   font-size: small;\r
84   border-top: 2px solid silver;\r
85   padding-top: 0.5em;\r
86   margin-top: 4.0em;\r
87 }\r
88 div#footer-text {\r
89   float: left;\r
90   padding-bottom: 0.5em;\r
91 }\r
92 div#footer-badges {\r
93   float: right;\r
94   padding-bottom: 0.5em;\r
95 }\r
96 \r
97 div#preamble,\r
98 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,\r
99 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,\r
100 div.admonitionblock {\r
101   margin-right: 10%;\r
102   margin-top: 1.5em;\r
103   margin-bottom: 1.5em;\r
104 }\r
105 div.admonitionblock {\r
106   margin-top: 2.5em;\r
107   margin-bottom: 2.5em;\r
108 }\r
109 \r
110 div.content { /* Block element content. */\r
111   padding: 0;\r
112 }\r
113 \r
114 /* Block element titles. */\r
115 div.title, caption.title {\r
116   font-family: sans-serif;\r
117   font-weight: bold;\r
118   text-align: left;\r
119   margin-top: 1.0em;\r
120   margin-bottom: 0.5em;\r
121 }\r
122 div.title + * {\r
123   margin-top: 0;\r
124 }\r
125 \r
126 td div.title:first-child {\r
127   margin-top: 0.0em;\r
128 }\r
129 div.content div.title:first-child {\r
130   margin-top: 0.0em;\r
131 }\r
132 div.content + div.title {\r
133   margin-top: 0.0em;\r
134 }\r
135 \r
136 div.sidebarblock > div.content {\r
137   background: #ffffee;\r
138   border: 1px solid silver;\r
139   padding: 0.5em;\r
140 }\r
141 \r
142 div.listingblock > div.content {\r
143   border: 1px solid silver;\r
144   background: #f4f4f4;\r
145   padding: 0.5em;\r
146 }\r
147 \r
148 div.quoteblock > div.content {\r
149   padding-left: 2.0em;\r
150 }\r
151 div.quoteblock .attribution {\r
152   text-align: right;\r
153 }\r
154 \r
155 div.admonitionblock .icon {\r
156   vertical-align: top;\r
157   font-size: 1.1em;\r
158   font-weight: bold;\r
159   text-decoration: underline;\r
160   color: #527bbd;\r
161   padding-right: 0.5em;\r
162 }\r
163 div.admonitionblock td.content {\r
164   padding-left: 0.5em;\r
165   border-left: 2px solid silver;\r
166 }\r
167 \r
168 div.exampleblock > div.content {\r
169   border-left: 2px solid silver;\r
170   padding: 0.5em;\r
171 }\r
172 \r
173 div.verseblock div.content {\r
174   white-space: pre;\r
175 }\r
176 \r
177 div.imageblock div.content { padding-left: 0; }\r
178 div.imageblock img { border: 1px solid silver; }\r
179 span.image img { border-style: none; }\r
180 \r
181 dl {\r
182   margin-top: 0.8em;\r
183   margin-bottom: 0.8em;\r
184 }\r
185 dt {\r
186   margin-top: 0.5em;\r
187   margin-bottom: 0;\r
188   font-style: italic;\r
189 }\r
190 dd > *:first-child {\r
191   margin-top: 0;\r
192 }\r
193 \r
194 ul, ol {\r
195     list-style-position: outside;\r
196 }\r
197 ol.olist2 {\r
198   list-style-type: lower-alpha;\r
199 }\r
200 \r
201 div.tableblock > table {\r
202   border-color: #527bbd;\r
203   border-width: 3px;\r
204 }\r
205 thead {\r
206   font-family: sans-serif;\r
207   font-weight: bold;\r
208 }\r
209 tfoot {\r
210   font-weight: bold;\r
211 }\r
212 \r
213 div.hlist {\r
214   margin-top: 0.8em;\r
215   margin-bottom: 0.8em;\r
216 }\r
217 td.hlist1 {\r
218   vertical-align: top;\r
219   font-style: italic;\r
220   padding-right: 0.8em;\r
221 }\r
222 td.hlist2 {\r
223   vertical-align: top;\r
224 }\r
225 \r
226 @media print {\r
227   div#footer-badges { display: none; }\r
228 }\r
229 include::./stylesheets/xhtml11-manpage.css[]\r
230 /* Workarounds for IE6's broken and incomplete CSS2. */\r
231 \r
232 div.sidebar-content {\r
233   background: #ffffee;\r
234   border: 1px solid silver;\r
235   padding: 0.5em;\r
236 }\r
237 div.sidebar-title, div.image-title {\r
238   font-family: sans-serif;\r
239   font-weight: bold;\r
240   margin-top: 0.0em;\r
241   margin-bottom: 0.5em;\r
242 }\r
243 \r
244 div.listingblock div.content {\r
245   border: 1px solid silver;\r
246   background: #f4f4f4;\r
247   padding: 0.5em;\r
248 }\r
249 \r
250 div.quoteblock-content {\r
251   padding-left: 2.0em;\r
252 }\r
253 \r
254 div.exampleblock-content {\r
255   border-left: 2px solid silver;\r
256   padding-left: 0.5em;\r
257 }\r
258 </style>\r
259 <title>git(7)</title>\r
260 </head>\r
261 <body>\r
262 <div id="header">\r
263 <h1>\r
264 git(7) Manual Page\r
265 </h1>\r
266 <h2>NAME</h2>\r
267 <div class="sectionbody">\r
268 <p>git -\r
269    the stupid content tracker\r
270 </p>\r
271 </div>\r
272 </div>\r
273 <h2>SYNOPSIS</h2>\r
274 <div class="sectionbody">\r
275 <p><em>git</em> [--version] [--exec-path[=GIT_EXEC_PATH]] [--help] COMMAND [ARGS]</p>\r
276 </div>\r
277 <h2>DESCRIPTION</h2>\r
278 <div class="sectionbody">\r
279 <p>Git is a fast, scalable, distributed revision control system with an\r
280 unusually rich command set that provides both high-level operations\r
281 and full access to internals.</p>\r
282 <p>See this <a href="tutorial.html">tutorial</a> to get started, then see\r
283 <a href="everyday.html">Everyday Git</a> for a useful minimum set of commands, and\r
284 "man git-commandname" for documentation of each command.  CVS users may\r
285 also want to read <a href="cvs-migration.html">CVS migration</a>.</p>\r
286 </div>\r
287 <h2>OPTIONS</h2>\r
288 <div class="sectionbody">\r
289 <dl>\r
290 <dt>\r
291 --version\r
292 </dt>\r
293 <dd>\r
294 <p>\r
295         Prints the git suite version that the <em>git</em> program came from.\r
296 </p>\r
297 </dd>\r
298 <dt>\r
299 --help\r
300 </dt>\r
301 <dd>\r
302 <p>\r
303         Prints the synopsis and a list of the most commonly used\r
304         commands.  If a git command is named this option will bring up\r
305         the man-page for that command. If the option <em>--all</em> or <em>-a</em> is\r
306         given then all available commands are printed.\r
307 </p>\r
308 </dd>\r
309 <dt>\r
310 --exec-path\r
311 </dt>\r
312 <dd>\r
313 <p>\r
314         Path to wherever your core git programs are installed.\r
315         This can also be controlled by setting the GIT_EXEC_PATH\r
316         environment variable. If no path is given <em>git</em> will print\r
317         the current setting and then exit.\r
318 </p>\r
319 </dd>\r
320 </dl>\r
321 </div>\r
322 <h2>FURTHER DOCUMENTATION</h2>\r
323 <div class="sectionbody">\r
324 <p>See the references above to get started using git.  The following is\r
325 probably more detail than necessary for a first-time user.</p>\r
326 <p>The <a href="#Discussion">Discussion</a> section below and the\r
327 <a href="core-tutorial.html">Core tutorial</a> both provide introductions to the\r
328 underlying git architecture.</p>\r
329 <p>See also the <a href="howto-index.html">howto</a> documents for some useful\r
330 examples.</p>\r
331 </div>\r
332 <h2>GIT COMMANDS</h2>\r
333 <div class="sectionbody">\r
334 <p>We divide git into high level ("porcelain") commands and low level\r
335 ("plumbing") commands.</p>\r
336 </div>\r
337 <h2>Low-level commands (plumbing)</h2>\r
338 <div class="sectionbody">\r
339 <p>Although git includes its\r
340 own porcelain layer, its low-level commands are sufficient to support\r
341 development of alternative porcelains.  Developers of such porcelains\r
342 might start by reading about <a href="git-update-index.html">git-update-index(1)</a> and\r
343 <a href="git-read-tree.html">git-read-tree(1)</a>.</p>\r
344 <p>We divide the low-level commands into commands that manipulate objects (in\r
345 the repository, index, and working tree), commands that interrogate and\r
346 compare objects, and commands that move objects and references between\r
347 repositories.</p>\r
348 <h3>Manipulation commands</h3>\r
349 <dl>\r
350 <dt>\r
351 <a href="git-apply.html">git-apply(1)</a>\r
352 </dt>\r
353 <dd>\r
354 <p>\r
355         Reads a "diff -up1" or git generated patch file and\r
356         applies it to the working tree.\r
357 </p>\r
358 </dd>\r
359 <dt>\r
360 <a href="git-checkout-index.html">git-checkout-index(1)</a>\r
361 </dt>\r
362 <dd>\r
363 <p>\r
364         Copy files from the index to the working tree.\r
365 </p>\r
366 </dd>\r
367 <dt>\r
368 <a href="git-commit-tree.html">git-commit-tree(1)</a>\r
369 </dt>\r
370 <dd>\r
371 <p>\r
372         Creates a new commit object.\r
373 </p>\r
374 </dd>\r
375 <dt>\r
376 <a href="git-hash-object.html">git-hash-object(1)</a>\r
377 </dt>\r
378 <dd>\r
379 <p>\r
380         Computes the object ID from a file.\r
381 </p>\r
382 </dd>\r
383 <dt>\r
384 <a href="git-index-pack.html">git-index-pack(1)</a>\r
385 </dt>\r
386 <dd>\r
387 <p>\r
388         Build pack idx file for an existing packed archive.\r
389 </p>\r
390 </dd>\r
391 <dt>\r
392 <a href="git-init-db.html">git-init-db(1)</a>\r
393 </dt>\r
394 <dd>\r
395 <p>\r
396         Creates an empty git object database, or reinitialize an\r
397         existing one.\r
398 </p>\r
399 </dd>\r
400 <dt>\r
401 <a href="git-merge-index.html">git-merge-index(1)</a>\r
402 </dt>\r
403 <dd>\r
404 <p>\r
405         Runs a merge for files needing merging.\r
406 </p>\r
407 </dd>\r
408 <dt>\r
409 <a href="git-mktag.html">git-mktag(1)</a>\r
410 </dt>\r
411 <dd>\r
412 <p>\r
413         Creates a tag object.\r
414 </p>\r
415 </dd>\r
416 <dt>\r
417 <a href="git-mktree.html">git-mktree(1)</a>\r
418 </dt>\r
419 <dd>\r
420 <p>\r
421         Build a tree-object from ls-tree formatted text.\r
422 </p>\r
423 </dd>\r
424 <dt>\r
425 <a href="git-pack-objects.html">git-pack-objects(1)</a>\r
426 </dt>\r
427 <dd>\r
428 <p>\r
429         Creates a packed archive of objects.\r
430 </p>\r
431 </dd>\r
432 <dt>\r
433 <a href="git-prune-packed.html">git-prune-packed(1)</a>\r
434 </dt>\r
435 <dd>\r
436 <p>\r
437         Remove extra objects that are already in pack files.\r
438 </p>\r
439 </dd>\r
440 <dt>\r
441 <a href="git-read-tree.html">git-read-tree(1)</a>\r
442 </dt>\r
443 <dd>\r
444 <p>\r
445         Reads tree information into the index.\r
446 </p>\r
447 </dd>\r
448 <dt>\r
449 <a href="git-repo-config.html">git-repo-config(1)</a>\r
450 </dt>\r
451 <dd>\r
452 <p>\r
453         Get and set options in .git/config.\r
454 </p>\r
455 </dd>\r
456 <dt>\r
457 <a href="git-unpack-objects.html">git-unpack-objects(1)</a>\r
458 </dt>\r
459 <dd>\r
460 <p>\r
461         Unpacks objects out of a packed archive.\r
462 </p>\r
463 </dd>\r
464 <dt>\r
465 <a href="git-update-index.html">git-update-index(1)</a>\r
466 </dt>\r
467 <dd>\r
468 <p>\r
469         Registers files in the working tree to the index.\r
470 </p>\r
471 </dd>\r
472 <dt>\r
473 <a href="git-write-tree.html">git-write-tree(1)</a>\r
474 </dt>\r
475 <dd>\r
476 <p>\r
477         Creates a tree from the index.\r
478 </p>\r
479 </dd>\r
480 </dl>\r
481 <h3>Interrogation commands</h3>\r
482 <dl>\r
483 <dt>\r
484 <a href="git-cat-file.html">git-cat-file(1)</a>\r
485 </dt>\r
486 <dd>\r
487 <p>\r
488         Provide content or type/size information for repository objects.\r
489 </p>\r
490 </dd>\r
491 <dt>\r
492 <a href="git-describe.html">git-describe(1)</a>\r
493 </dt>\r
494 <dd>\r
495 <p>\r
496         Show the most recent tag that is reachable from a commit.\r
497 </p>\r
498 </dd>\r
499 <dt>\r
500 <a href="git-diff-index.html">git-diff-index(1)</a>\r
501 </dt>\r
502 <dd>\r
503 <p>\r
504         Compares content and mode of blobs between the index and repository.\r
505 </p>\r
506 </dd>\r
507 <dt>\r
508 <a href="git-diff-files.html">git-diff-files(1)</a>\r
509 </dt>\r
510 <dd>\r
511 <p>\r
512         Compares files in the working tree and the index.\r
513 </p>\r
514 </dd>\r
515 <dt>\r
516 <a href="git-diff-stages.html">git-diff-stages(1)</a>\r
517 </dt>\r
518 <dd>\r
519 <p>\r
520         Compares two "merge stages" in the index.\r
521 </p>\r
522 </dd>\r
523 <dt>\r
524 <a href="git-diff-tree.html">git-diff-tree(1)</a>\r
525 </dt>\r
526 <dd>\r
527 <p>\r
528         Compares the content and mode of blobs found via two tree objects.\r
529 </p>\r
530 </dd>\r
531 <dt>\r
532 <a href="git-fsck-objects.html">git-fsck-objects(1)</a>\r
533 </dt>\r
534 <dd>\r
535 <p>\r
536         Verifies the connectivity and validity of the objects in the database.\r
537 </p>\r
538 </dd>\r
539 <dt>\r
540 <a href="git-ls-files.html">git-ls-files(1)</a>\r
541 </dt>\r
542 <dd>\r
543 <p>\r
544         Information about files in the index and the working tree.\r
545 </p>\r
546 </dd>\r
547 <dt>\r
548 <a href="git-ls-tree.html">git-ls-tree(1)</a>\r
549 </dt>\r
550 <dd>\r
551 <p>\r
552         Displays a tree object in human readable form.\r
553 </p>\r
554 </dd>\r
555 <dt>\r
556 <a href="git-merge-base.html">git-merge-base(1)</a>\r
557 </dt>\r
558 <dd>\r
559 <p>\r
560         Finds as good common ancestors as possible for a merge.\r
561 </p>\r
562 </dd>\r
563 <dt>\r
564 <a href="git-name-rev.html">git-name-rev(1)</a>\r
565 </dt>\r
566 <dd>\r
567 <p>\r
568         Find symbolic names for given revs.\r
569 </p>\r
570 </dd>\r
571 <dt>\r
572 <a href="git-pack-redundant.html">git-pack-redundant(1)</a>\r
573 </dt>\r
574 <dd>\r
575 <p>\r
576         Find redundant pack files.\r
577 </p>\r
578 </dd>\r
579 <dt>\r
580 <a href="git-rev-list.html">git-rev-list(1)</a>\r
581 </dt>\r
582 <dd>\r
583 <p>\r
584         Lists commit objects in reverse chronological order.\r
585 </p>\r
586 </dd>\r
587 <dt>\r
588 <a href="git-show-index.html">git-show-index(1)</a>\r
589 </dt>\r
590 <dd>\r
591 <p>\r
592         Displays contents of a pack idx file.\r
593 </p>\r
594 </dd>\r
595 <dt>\r
596 <a href="git-tar-tree.html">git-tar-tree(1)</a>\r
597 </dt>\r
598 <dd>\r
599 <p>\r
600         Creates a tar archive of the files in the named tree object.\r
601 </p>\r
602 </dd>\r
603 <dt>\r
604 <a href="git-unpack-file.html">git-unpack-file(1)</a>\r
605 </dt>\r
606 <dd>\r
607 <p>\r
608         Creates a temporary file with a blob's contents.\r
609 </p>\r
610 </dd>\r
611 <dt>\r
612 <a href="git-var.html">git-var(1)</a>\r
613 </dt>\r
614 <dd>\r
615 <p>\r
616         Displays a git logical variable.\r
617 </p>\r
618 </dd>\r
619 <dt>\r
620 <a href="git-verify-pack.html">git-verify-pack(1)</a>\r
621 </dt>\r
622 <dd>\r
623 <p>\r
624         Validates packed git archive files.\r
625 </p>\r
626 </dd>\r
627 </dl>\r
628 <p>In general, the interrogate commands do not touch the files in\r
629 the working tree.</p>\r
630 <h3>Synching repositories</h3>\r
631 <dl>\r
632 <dt>\r
633 <a href="git-clone-pack.html">git-clone-pack(1)</a>\r
634 </dt>\r
635 <dd>\r
636 <p>\r
637         Clones a repository into the current repository (engine\r
638         for ssh and local transport).\r
639 </p>\r
640 </dd>\r
641 <dt>\r
642 <a href="git-fetch-pack.html">git-fetch-pack(1)</a>\r
643 </dt>\r
644 <dd>\r
645 <p>\r
646         Updates from a remote repository (engine for ssh and\r
647         local transport).\r
648 </p>\r
649 </dd>\r
650 <dt>\r
651 <a href="git-http-fetch.html">git-http-fetch(1)</a>\r
652 </dt>\r
653 <dd>\r
654 <p>\r
655         Downloads a remote git repository via HTTP by walking\r
656         commit chain.\r
657 </p>\r
658 </dd>\r
659 <dt>\r
660 <a href="git-local-fetch.html">git-local-fetch(1)</a>\r
661 </dt>\r
662 <dd>\r
663 <p>\r
664         Duplicates another git repository on a local system by\r
665         walking commit chain.\r
666 </p>\r
667 </dd>\r
668 <dt>\r
669 <a href="git-peek-remote.html">git-peek-remote(1)</a>\r
670 </dt>\r
671 <dd>\r
672 <p>\r
673         Lists references on a remote repository using\r
674         upload-pack protocol (engine for ssh and local\r
675         transport).\r
676 </p>\r
677 </dd>\r
678 <dt>\r
679 <a href="git-receive-pack.html">git-receive-pack(1)</a>\r
680 </dt>\r
681 <dd>\r
682 <p>\r
683         Invoked by <em>git-send-pack</em> to receive what is pushed to it.\r
684 </p>\r
685 </dd>\r
686 <dt>\r
687 <a href="git-send-pack.html">git-send-pack(1)</a>\r
688 </dt>\r
689 <dd>\r
690 <p>\r
691         Pushes to a remote repository, intelligently.\r
692 </p>\r
693 </dd>\r
694 <dt>\r
695 <a href="git-http-push.html">git-http-push(1)</a>\r
696 </dt>\r
697 <dd>\r
698 <p>\r
699         Push missing objects using HTTP/DAV.\r
700 </p>\r
701 </dd>\r
702 <dt>\r
703 <a href="git-shell.html">git-shell(1)</a>\r
704 </dt>\r
705 <dd>\r
706 <p>\r
707         Restricted shell for GIT-only SSH access.\r
708 </p>\r
709 </dd>\r
710 <dt>\r
711 <a href="git-ssh-fetch.html">git-ssh-fetch(1)</a>\r
712 </dt>\r
713 <dd>\r
714 <p>\r
715         Pulls from a remote repository over ssh connection by\r
716         walking commit chain.\r
717 </p>\r
718 </dd>\r
719 <dt>\r
720 <a href="git-ssh-upload.html">git-ssh-upload(1)</a>\r
721 </dt>\r
722 <dd>\r
723 <p>\r
724         Helper "server-side" program used by git-ssh-fetch.\r
725 </p>\r
726 </dd>\r
727 <dt>\r
728 <a href="git-update-server-info.html">git-update-server-info(1)</a>\r
729 </dt>\r
730 <dd>\r
731 <p>\r
732         Updates auxiliary information on a dumb server to help\r
733         clients discover references and packs on it.\r
734 </p>\r
735 </dd>\r
736 <dt>\r
737 <a href="git-upload-pack.html">git-upload-pack(1)</a>\r
738 </dt>\r
739 <dd>\r
740 <p>\r
741         Invoked by <em>git-clone-pack</em> and <em>git-fetch-pack</em> to push\r
742         what are asked for.\r
743 </p>\r
744 </dd>\r
745 </dl>\r
746 </div>\r
747 <h2>High-level commands (porcelain)</h2>\r
748 <div class="sectionbody">\r
749 <p>We separate the porcelain commands into the main commands and some\r
750 ancillary user utilities.</p>\r
751 <h3>Main porcelain commands</h3>\r
752 <dl>\r
753 <dt>\r
754 <a href="git-add.html">git-add(1)</a>\r
755 </dt>\r
756 <dd>\r
757 <p>\r
758         Add paths to the index.\r
759 </p>\r
760 </dd>\r
761 <dt>\r
762 <a href="git-am.html">git-am(1)</a>\r
763 </dt>\r
764 <dd>\r
765 <p>\r
766         Apply patches from a mailbox, but cooler.\r
767 </p>\r
768 </dd>\r
769 <dt>\r
770 <a href="git-applymbox.html">git-applymbox(1)</a>\r
771 </dt>\r
772 <dd>\r
773 <p>\r
774         Apply patches from a mailbox, original version by Linus.\r
775 </p>\r
776 </dd>\r
777 <dt>\r
778 <a href="git-bisect.html">git-bisect(1)</a>\r
779 </dt>\r
780 <dd>\r
781 <p>\r
782         Find the change that introduced a bug by binary search.\r
783 </p>\r
784 </dd>\r
785 <dt>\r
786 <a href="git-branch.html">git-branch(1)</a>\r
787 </dt>\r
788 <dd>\r
789 <p>\r
790         Create and Show branches.\r
791 </p>\r
792 </dd>\r
793 <dt>\r
794 <a href="git-checkout.html">git-checkout(1)</a>\r
795 </dt>\r
796 <dd>\r
797 <p>\r
798         Checkout and switch to a branch.\r
799 </p>\r
800 </dd>\r
801 <dt>\r
802 <a href="git-cherry-pick.html">git-cherry-pick(1)</a>\r
803 </dt>\r
804 <dd>\r
805 <p>\r
806         Cherry-pick the effect of an existing commit.\r
807 </p>\r
808 </dd>\r
809 <dt>\r
810 <a href="git-clean.html">git-clean(1)</a>\r
811 </dt>\r
812 <dd>\r
813 <p>\r
814         Remove untracked files from the working tree.\r
815 </p>\r
816 </dd>\r
817 <dt>\r
818 <a href="git-clone.html">git-clone(1)</a>\r
819 </dt>\r
820 <dd>\r
821 <p>\r
822         Clones a repository into a new directory.\r
823 </p>\r
824 </dd>\r
825 <dt>\r
826 <a href="git-commit.html">git-commit(1)</a>\r
827 </dt>\r
828 <dd>\r
829 <p>\r
830         Record changes to the repository.\r
831 </p>\r
832 </dd>\r
833 <dt>\r
834 <a href="git-diff.html">git-diff(1)</a>\r
835 </dt>\r
836 <dd>\r
837 <p>\r
838         Show changes between commits, commit and working tree, etc.\r
839 </p>\r
840 </dd>\r
841 <dt>\r
842 <a href="git-fetch.html">git-fetch(1)</a>\r
843 </dt>\r
844 <dd>\r
845 <p>\r
846         Download from a remote repository via various protocols.\r
847 </p>\r
848 </dd>\r
849 <dt>\r
850 <a href="git-format-patch.html">git-format-patch(1)</a>\r
851 </dt>\r
852 <dd>\r
853 <p>\r
854         Prepare patches for e-mail submission.\r
855 </p>\r
856 </dd>\r
857 <dt>\r
858 <a href="git-grep.html">git-grep(1)</a>\r
859 </dt>\r
860 <dd>\r
861 <p>\r
862         Print lines matching a pattern.\r
863 </p>\r
864 </dd>\r
865 <dt>\r
866 <a href="git-log.html">git-log(1)</a>\r
867 </dt>\r
868 <dd>\r
869 <p>\r
870         Shows commit logs.\r
871 </p>\r
872 </dd>\r
873 <dt>\r
874 <a href="git-ls-remote.html">git-ls-remote(1)</a>\r
875 </dt>\r
876 <dd>\r
877 <p>\r
878         Shows references in a remote or local repository.\r
879 </p>\r
880 </dd>\r
881 <dt>\r
882 <a href="git-merge.html">git-merge(1)</a>\r
883 </dt>\r
884 <dd>\r
885 <p>\r
886         Grand unified merge driver.\r
887 </p>\r
888 </dd>\r
889 <dt>\r
890 <a href="git-mv.html">git-mv(1)</a>\r
891 </dt>\r
892 <dd>\r
893 <p>\r
894         Move or rename a file, a directory, or a symlink.\r
895 </p>\r
896 </dd>\r
897 <dt>\r
898 <a href="git-pull.html">git-pull(1)</a>\r
899 </dt>\r
900 <dd>\r
901 <p>\r
902         Fetch from and merge with a remote repository.\r
903 </p>\r
904 </dd>\r
905 <dt>\r
906 <a href="git-push.html">git-push(1)</a>\r
907 </dt>\r
908 <dd>\r
909 <p>\r
910         Update remote refs along with associated objects.\r
911 </p>\r
912 </dd>\r
913 <dt>\r
914 <a href="git-rebase.html">git-rebase(1)</a>\r
915 </dt>\r
916 <dd>\r
917 <p>\r
918         Rebase local commits to the updated upstream head.\r
919 </p>\r
920 </dd>\r
921 <dt>\r
922 <a href="git-repack.html">git-repack(1)</a>\r
923 </dt>\r
924 <dd>\r
925 <p>\r
926         Pack unpacked objects in a repository.\r
927 </p>\r
928 </dd>\r
929 <dt>\r
930 <a href="git-rerere.html">git-rerere(1)</a>\r
931 </dt>\r
932 <dd>\r
933 <p>\r
934         Reuse recorded resolution of conflicted merges.\r
935 </p>\r
936 </dd>\r
937 <dt>\r
938 <a href="git-reset.html">git-reset(1)</a>\r
939 </dt>\r
940 <dd>\r
941 <p>\r
942         Reset current HEAD to the specified state.\r
943 </p>\r
944 </dd>\r
945 <dt>\r
946 <a href="git-resolve.html">git-resolve(1)</a>\r
947 </dt>\r
948 <dd>\r
949 <p>\r
950         Merge two commits.\r
951 </p>\r
952 </dd>\r
953 <dt>\r
954 <a href="git-revert.html">git-revert(1)</a>\r
955 </dt>\r
956 <dd>\r
957 <p>\r
958         Revert an existing commit.\r
959 </p>\r
960 </dd>\r
961 <dt>\r
962 <a href="git-rm.html">git-rm(1)</a>\r
963 </dt>\r
964 <dd>\r
965 <p>\r
966         Remove files from the working tree and from the index.\r
967 </p>\r
968 </dd>\r
969 <dt>\r
970 <a href="git-shortlog.html">git-shortlog(1)</a>\r
971 </dt>\r
972 <dd>\r
973 <p>\r
974         Summarizes <em>git log</em> output.\r
975 </p>\r
976 </dd>\r
977 <dt>\r
978 <a href="git-show.html">git-show(1)</a>\r
979 </dt>\r
980 <dd>\r
981 <p>\r
982         Show one commit log and its diff.\r
983 </p>\r
984 </dd>\r
985 <dt>\r
986 <a href="git-show-branch.html">git-show-branch(1)</a>\r
987 </dt>\r
988 <dd>\r
989 <p>\r
990         Show branches and their commits.\r
991 </p>\r
992 </dd>\r
993 <dt>\r
994 <a href="git-status.html">git-status(1)</a>\r
995 </dt>\r
996 <dd>\r
997 <p>\r
998         Shows the working tree status.\r
999 </p>\r
1000 </dd>\r
1001 <dt>\r
1002 <a href="git-verify-tag.html">git-verify-tag(1)</a>\r
1003 </dt>\r
1004 <dd>\r
1005 <p>\r
1006         Check the GPG signature of tag.\r
1007 </p>\r
1008 </dd>\r
1009 <dt>\r
1010 <a href="git-whatchanged.html">git-whatchanged(1)</a>\r
1011 </dt>\r
1012 <dd>\r
1013 <p>\r
1014         Shows commit logs and differences they introduce.\r
1015 </p>\r
1016 </dd>\r
1017 </dl>\r
1018 <h3>Ancillary Commands</h3>\r
1019 <p>Manipulators:</p>\r
1020 <dl>\r
1021 <dt>\r
1022 <a href="git-applypatch.html">git-applypatch(1)</a>\r
1023 </dt>\r
1024 <dd>\r
1025 <p>\r
1026         Apply one patch extracted from an e-mail.\r
1027 </p>\r
1028 </dd>\r
1029 <dt>\r
1030 <a href="git-archimport.html">git-archimport(1)</a>\r
1031 </dt>\r
1032 <dd>\r
1033 <p>\r
1034         Import an arch repository into git.\r
1035 </p>\r
1036 </dd>\r
1037 <dt>\r
1038 <a href="git-convert-objects.html">git-convert-objects(1)</a>\r
1039 </dt>\r
1040 <dd>\r
1041 <p>\r
1042         Converts old-style git repository.\r
1043 </p>\r
1044 </dd>\r
1045 <dt>\r
1046 <a href="git-cvsimport.html">git-cvsimport(1)</a>\r
1047 </dt>\r
1048 <dd>\r
1049 <p>\r
1050         Salvage your data out of another SCM people love to hate.\r
1051 </p>\r
1052 </dd>\r
1053 <dt>\r
1054 <a href="git-cvsexportcommit.html">git-cvsexportcommit(1)</a>\r
1055 </dt>\r
1056 <dd>\r
1057 <p>\r
1058         Export a single commit to a CVS checkout.\r
1059 </p>\r
1060 </dd>\r
1061 <dt>\r
1062 <a href="git-cvsserver.html">git-cvsserver(1)</a>\r
1063 </dt>\r
1064 <dd>\r
1065 <p>\r
1066         A CVS server emulator for git.\r
1067 </p>\r
1068 </dd>\r
1069 <dt>\r
1070 <a href="git-lost-found.html">git-lost-found(1)</a>\r
1071 </dt>\r
1072 <dd>\r
1073 <p>\r
1074         Recover lost refs that luckily have not yet been pruned.\r
1075 </p>\r
1076 </dd>\r
1077 <dt>\r
1078 <a href="git-merge-one-file.html">git-merge-one-file(1)</a>\r
1079 </dt>\r
1080 <dd>\r
1081 <p>\r
1082         The standard helper program to use with <tt>git-merge-index</tt>.\r
1083 </p>\r
1084 </dd>\r
1085 <dt>\r
1086 <a href="git-prune.html">git-prune(1)</a>\r
1087 </dt>\r
1088 <dd>\r
1089 <p>\r
1090         Prunes all unreachable objects from the object database.\r
1091 </p>\r
1092 </dd>\r
1093 <dt>\r
1094 <a href="git-relink.html">git-relink(1)</a>\r
1095 </dt>\r
1096 <dd>\r
1097 <p>\r
1098         Hardlink common objects in local repositories.\r
1099 </p>\r
1100 </dd>\r
1101 <dt>\r
1102 <a href="git-svnimport.html">git-svnimport(1)</a>\r
1103 </dt>\r
1104 <dd>\r
1105 <p>\r
1106         Import a SVN repository into git.\r
1107 </p>\r
1108 </dd>\r
1109 <dt>\r
1110 <a href="git-sh-setup.html">git-sh-setup(1)</a>\r
1111 </dt>\r
1112 <dd>\r
1113 <p>\r
1114         Common git shell script setup code.\r
1115 </p>\r
1116 </dd>\r
1117 <dt>\r
1118 <a href="git-symbolic-ref.html">git-symbolic-ref(1)</a>\r
1119 </dt>\r
1120 <dd>\r
1121 <p>\r
1122         Read and modify symbolic refs.\r
1123 </p>\r
1124 </dd>\r
1125 <dt>\r
1126 <a href="git-tag.html">git-tag(1)</a>\r
1127 </dt>\r
1128 <dd>\r
1129 <p>\r
1130         An example script to create a tag object signed with GPG.\r
1131 </p>\r
1132 </dd>\r
1133 <dt>\r
1134 <a href="git-update-ref.html">git-update-ref(1)</a>\r
1135 </dt>\r
1136 <dd>\r
1137 <p>\r
1138         Update the object name stored in a ref safely.\r
1139 </p>\r
1140 </dd>\r
1141 </dl>\r
1142 <p>Interrogators:</p>\r
1143 <dl>\r
1144 <dt>\r
1145 <a href="git-annotate.html">git-annotate(1)</a>\r
1146 </dt>\r
1147 <dd>\r
1148 <p>\r
1149         Annotate file lines with commit info.\r
1150 </p>\r
1151 </dd>\r
1152 <dt>\r
1153 <a href="git-blame.html">git-blame(1)</a>\r
1154 </dt>\r
1155 <dd>\r
1156 <p>\r
1157         Blame file lines on commits.\r
1158 </p>\r
1159 </dd>\r
1160 <dt>\r
1161 <a href="git-check-ref-format.html">git-check-ref-format(1)</a>\r
1162 </dt>\r
1163 <dd>\r
1164 <p>\r
1165         Make sure ref name is well formed.\r
1166 </p>\r
1167 </dd>\r
1168 <dt>\r
1169 <a href="git-cherry.html">git-cherry(1)</a>\r
1170 </dt>\r
1171 <dd>\r
1172 <p>\r
1173         Find commits not merged upstream.\r
1174 </p>\r
1175 </dd>\r
1176 <dt>\r
1177 <a href="git-count-objects.html">git-count-objects(1)</a>\r
1178 </dt>\r
1179 <dd>\r
1180 <p>\r
1181         Count unpacked number of objects and their disk consumption.\r
1182 </p>\r
1183 </dd>\r
1184 <dt>\r
1185 <a href="git-daemon.html">git-daemon(1)</a>\r
1186 </dt>\r
1187 <dd>\r
1188 <p>\r
1189         A really simple server for git repositories.\r
1190 </p>\r
1191 </dd>\r
1192 <dt>\r
1193 <a href="git-fmt-merge-msg.html">git-fmt-merge-msg(1)</a>\r
1194 </dt>\r
1195 <dd>\r
1196 <p>\r
1197         Produce a merge commit message.\r
1198 </p>\r
1199 </dd>\r
1200 <dt>\r
1201 <a href="git-get-tar-commit-id.html">git-get-tar-commit-id(1)</a>\r
1202 </dt>\r
1203 <dd>\r
1204 <p>\r
1205         Extract commit ID from an archive created using git-tar-tree.\r
1206 </p>\r
1207 </dd>\r
1208 <dt>\r
1209 <a href="git-imap-send.html">git-imap-send(1)</a>\r
1210 </dt>\r
1211 <dd>\r
1212 <p>\r
1213         Dump a mailbox from stdin into an imap folder.\r
1214 </p>\r
1215 </dd>\r
1216 <dt>\r
1217 <a href="git-mailinfo.html">git-mailinfo(1)</a>\r
1218 </dt>\r
1219 <dd>\r
1220 <p>\r
1221         Extracts patch and authorship information from a single\r
1222         e-mail message, optionally transliterating the commit\r
1223         message into utf-8.\r
1224 </p>\r
1225 </dd>\r
1226 <dt>\r
1227 <a href="git-mailsplit.html">git-mailsplit(1)</a>\r
1228 </dt>\r
1229 <dd>\r
1230 <p>\r
1231         A stupid program to split UNIX mbox format mailbox into\r
1232         individual pieces of e-mail.\r
1233 </p>\r
1234 </dd>\r
1235 <dt>\r
1236 <a href="git-merge-tree.html">git-merge-tree(1)</a>\r
1237 </dt>\r
1238 <dd>\r
1239 <p>\r
1240         Show three-way merge without touching index.\r
1241 </p>\r
1242 </dd>\r
1243 <dt>\r
1244 <a href="git-patch-id.html">git-patch-id(1)</a>\r
1245 </dt>\r
1246 <dd>\r
1247 <p>\r
1248         Compute unique ID for a patch.\r
1249 </p>\r
1250 </dd>\r
1251 <dt>\r
1252 <a href="git-parse-remote.html">git-parse-remote(1)</a>\r
1253 </dt>\r
1254 <dd>\r
1255 <p>\r
1256         Routines to help parsing <tt>$GIT_DIR/remotes/</tt> files.\r
1257 </p>\r
1258 </dd>\r
1259 <dt>\r
1260 <a href="git-request-pull.html">git-request-pull(1)</a>\r
1261 </dt>\r
1262 <dd>\r
1263 <p>\r
1264         git-request-pull.\r
1265 </p>\r
1266 </dd>\r
1267 <dt>\r
1268 <a href="git-rev-parse.html">git-rev-parse(1)</a>\r
1269 </dt>\r
1270 <dd>\r
1271 <p>\r
1272         Pick out and massage parameters.\r
1273 </p>\r
1274 </dd>\r
1275 <dt>\r
1276 <a href="git-send-email.html">git-send-email(1)</a>\r
1277 </dt>\r
1278 <dd>\r
1279 <p>\r
1280         Send patch e-mails out of "format-patch --mbox" output.\r
1281 </p>\r
1282 </dd>\r
1283 <dt>\r
1284 <a href="git-symbolic-ref.html">git-symbolic-ref(1)</a>\r
1285 </dt>\r
1286 <dd>\r
1287 <p>\r
1288         Read and modify symbolic refs.\r
1289 </p>\r
1290 </dd>\r
1291 <dt>\r
1292 <a href="git-stripspace.html">git-stripspace(1)</a>\r
1293 </dt>\r
1294 <dd>\r
1295 <p>\r
1296         Filter out empty lines.\r
1297 </p>\r
1298 </dd>\r
1299 </dl>\r
1300 </div>\r
1301 <h2>Commands not yet documented</h2>\r
1302 <div class="sectionbody">\r
1303 <dl>\r
1304 <dt>\r
1305 <a href="gitk.html">gitk(1)</a>\r
1306 </dt>\r
1307 <dd>\r
1308 <p>\r
1309         The gitk repository browser.\r
1310 </p>\r
1311 </dd>\r
1312 </dl>\r
1313 </div>\r
1314 <h2>Configuration Mechanism</h2>\r
1315 <div class="sectionbody">\r
1316 <p>Starting from 0.99.9 (actually mid 0.99.8.GIT), <tt>.git/config</tt> file\r
1317 is used to hold per-repository configuration options.  It is a\r
1318 simple text file modelled after <tt>.ini</tt> format familiar to some\r
1319 people.  Here is an example:</p>\r
1320 <div class="listingblock">\r
1321 <div class="content">\r
1322 <pre><tt>#\r
1323 # A '#' or ';' character indicates a comment.\r
1324 #\r
1325 \r
1326 ; core variables\r
1327 [core]\r
1328         ; Don't trust file modes\r
1329         filemode = false\r
1330 \r
1331 ; user identity\r
1332 [user]\r
1333         name = "Junio C Hamano"\r
1334         email = "junkio@twinsun.com"\r
1335 </tt></pre>\r
1336 </div></div>\r
1337 <p>Various commands read from the configuration file and adjust\r
1338 their operation accordingly.</p>\r
1339 </div>\r
1340 <h2>Identifier Terminology</h2>\r
1341 <div class="sectionbody">\r
1342 <dl>\r
1343 <dt>\r
1344 &lt;object&gt;\r
1345 </dt>\r
1346 <dd>\r
1347 <p>\r
1348         Indicates the object name for any type of object.\r
1349 </p>\r
1350 </dd>\r
1351 <dt>\r
1352 &lt;blob&gt;\r
1353 </dt>\r
1354 <dd>\r
1355 <p>\r
1356         Indicates a blob object name.\r
1357 </p>\r
1358 </dd>\r
1359 <dt>\r
1360 &lt;tree&gt;\r
1361 </dt>\r
1362 <dd>\r
1363 <p>\r
1364         Indicates a tree object name.\r
1365 </p>\r
1366 </dd>\r
1367 <dt>\r
1368 &lt;commit&gt;\r
1369 </dt>\r
1370 <dd>\r
1371 <p>\r
1372         Indicates a commit object name.\r
1373 </p>\r
1374 </dd>\r
1375 <dt>\r
1376 &lt;tree-ish&gt;\r
1377 </dt>\r
1378 <dd>\r
1379 <p>\r
1380         Indicates a tree, commit or tag object name.  A\r
1381         command that takes a &lt;tree-ish&gt; argument ultimately wants to\r
1382         operate on a &lt;tree&gt; object but automatically dereferences\r
1383         &lt;commit&gt; and &lt;tag&gt; objects that point at a &lt;tree&gt;.\r
1384 </p>\r
1385 </dd>\r
1386 <dt>\r
1387 &lt;type&gt;\r
1388 </dt>\r
1389 <dd>\r
1390 <p>\r
1391         Indicates that an object type is required.\r
1392         Currently one of: <tt>blob</tt>, <tt>tree</tt>, <tt>commit</tt>, or <tt>tag</tt>.\r
1393 </p>\r
1394 </dd>\r
1395 <dt>\r
1396 &lt;file&gt;\r
1397 </dt>\r
1398 <dd>\r
1399 <p>\r
1400         Indicates a filename - almost always relative to the\r
1401         root of the tree structure <tt>GIT_INDEX_FILE</tt> describes.\r
1402 </p>\r
1403 </dd>\r
1404 </dl>\r
1405 </div>\r
1406 <h2>Symbolic Identifiers</h2>\r
1407 <div class="sectionbody">\r
1408 <p>Any git command accepting any &lt;object&gt; can also use the following\r
1409 symbolic notation:</p>\r
1410 <dl>\r
1411 <dt>\r
1412 HEAD\r
1413 </dt>\r
1414 <dd>\r
1415 <p>\r
1416         indicates the head of the current branch (i.e. the\r
1417         contents of <tt>$GIT_DIR/HEAD</tt>).\r
1418 </p>\r
1419 </dd>\r
1420 <dt>\r
1421 &lt;tag&gt;\r
1422 </dt>\r
1423 <dd>\r
1424 <p>\r
1425         a valid tag <em>name</em>\r
1426         (i.e. the contents of <tt>$GIT_DIR/refs/tags/&lt;tag&gt;</tt>).\r
1427 </p>\r
1428 </dd>\r
1429 <dt>\r
1430 &lt;head&gt;\r
1431 </dt>\r
1432 <dd>\r
1433 <p>\r
1434         a valid head <em>name</em>\r
1435         (i.e. the contents of <tt>$GIT_DIR/refs/heads/&lt;head&gt;</tt>).\r
1436 </p>\r
1437 </dd>\r
1438 </dl>\r
1439 </div>\r
1440 <h2>File/Directory Structure</h2>\r
1441 <div class="sectionbody">\r
1442 <p>Please see <a href="repository-layout.html">repository layout</a> document.</p>\r
1443 <p>Read <a href="hooks.html">hooks</a> for more details about each hook.</p>\r
1444 <p>Higher level SCMs may provide and manage additional information in the\r
1445 <tt>$GIT_DIR</tt>.</p>\r
1446 </div>\r
1447 <h2>Terminology</h2>\r
1448 <div class="sectionbody">\r
1449 <p>Please see <a href="glossary.html">glossary</a> document.</p>\r
1450 </div>\r
1451 <h2>Environment Variables</h2>\r
1452 <div class="sectionbody">\r
1453 <p>Various git commands use the following environment variables:</p>\r
1454 <h3>The git Repository</h3>\r
1455 <p>These environment variables apply to <em>all</em> core git commands. Nb: it\r
1456 is worth noting that they may be used/overridden by SCMS sitting above\r
1457 git so take care if using Cogito etc.</p>\r
1458 <dl>\r
1459 <dt>\r
1460 <em>GIT_INDEX_FILE</em>\r
1461 </dt>\r
1462 <dd>\r
1463 <p>\r
1464         This environment allows the specification of an alternate\r
1465         index file. If not specified, the default of <tt>$GIT_DIR/index</tt>\r
1466         is used.\r
1467 </p>\r
1468 </dd>\r
1469 <dt>\r
1470 <em>GIT_OBJECT_DIRECTORY</em>\r
1471 </dt>\r
1472 <dd>\r
1473 <p>\r
1474         If the object storage directory is specified via this\r
1475         environment variable then the sha1 directories are created\r
1476         underneath - otherwise the default <tt>$GIT_DIR/objects</tt>\r
1477         directory is used.\r
1478 </p>\r
1479 </dd>\r
1480 <dt>\r
1481 <em>GIT_ALTERNATE_OBJECT_DIRECTORIES</em>\r
1482 </dt>\r
1483 <dd>\r
1484 <p>\r
1485         Due to the immutable nature of git objects, old objects can be\r
1486         archived into shared, read-only directories. This variable\r
1487         specifies a ":" separated list of git object directories which\r
1488         can be used to search for git objects. New objects will not be\r
1489         written to these directories.\r
1490 </p>\r
1491 </dd>\r
1492 <dt>\r
1493 <em>GIT_DIR</em>\r
1494 </dt>\r
1495 <dd>\r
1496 <p>\r
1497         If the <em>GIT_DIR</em> environment variable is set then it\r
1498         specifies a path to use instead of the default <tt>.git</tt>\r
1499         for the base of the repository.\r
1500 </p>\r
1501 </dd>\r
1502 </dl>\r
1503 <h3>git Commits</h3>\r
1504 <dl>\r
1505 <dt>\r
1506 <em>GIT_AUTHOR_NAME</em>\r
1507 </dt>\r
1508 <dt>\r
1509 <em>GIT_AUTHOR_EMAIL</em>\r
1510 </dt>\r
1511 <dt>\r
1512 <em>GIT_AUTHOR_DATE</em>\r
1513 </dt>\r
1514 <dt>\r
1515 <em>GIT_COMMITTER_NAME</em>\r
1516 </dt>\r
1517 <dt>\r
1518 <em>GIT_COMMITTER_EMAIL</em>\r
1519 </dt>\r
1520 <dd>\r
1521 <p>\r
1522         see <a href="git-commit-tree.html">git-commit-tree(1)</a>\r
1523 </p>\r
1524 </dd>\r
1525 </dl>\r
1526 <h3>git Diffs</h3>\r
1527 <dl>\r
1528 <dt>\r
1529 <em>GIT_DIFF_OPTS</em>\r
1530 </dt>\r
1531 <dt>\r
1532 <em>GIT_EXTERNAL_DIFF</em>\r
1533 </dt>\r
1534 <dd>\r
1535 <p>\r
1536         see the "generating patches" section in :\r
1537         <a href="git-diff-index.html">git-diff-index(1)</a>;\r
1538         <a href="git-diff-files.html">git-diff-files(1)</a>;\r
1539         <a href="git-diff-tree.html">git-diff-tree(1)</a>\r
1540 </p>\r
1541 </dd>\r
1542 </dl>\r
1543 </div>\r
1544 <h2>Discussion<a id="Discussion"></a></h2>\r
1545 <div class="sectionbody">\r
1546 <p>"git" can mean anything, depending on your mood.</p>\r
1547 <ul>\r
1548 <li>\r
1549 <p>\r
1550 random three-letter combination that is pronounceable, and not\r
1551    actually used by any common UNIX command.  The fact that it is a\r
1552    mispronunciation of "get" may or may not be relevant.\r
1553 </p>\r
1554 </li>\r
1555 <li>\r
1556 <p>\r
1557 stupid. contemptible and despicable. simple. Take your pick from the\r
1558    dictionary of slang.\r
1559 </p>\r
1560 </li>\r
1561 <li>\r
1562 <p>\r
1563 "global information tracker": you're in a good mood, and it actually\r
1564    works for you. Angels sing, and a light suddenly fills the room.\r
1565 </p>\r
1566 </li>\r
1567 <li>\r
1568 <p>\r
1569 "goddamn idiotic truckload of sh*t": when it breaks\r
1570 </p>\r
1571 </li>\r
1572 </ul>\r
1573 <p>This is a stupid (but extremely fast) directory content manager.  It\r
1574 doesn't do a whole lot, but what it <em>does</em> do is track directory\r
1575 contents efficiently.</p>\r
1576 <p>There are two object abstractions: the "object database", and the\r
1577 "current directory cache" aka "index".</p>\r
1578 <h3>The Object Database</h3>\r
1579 <p>The object database is literally just a content-addressable collection\r
1580 of objects.  All objects are named by their content, which is\r
1581 approximated by the SHA1 hash of the object itself.  Objects may refer\r
1582 to other objects (by referencing their SHA1 hash), and so you can\r
1583 build up a hierarchy of objects.</p>\r
1584 <p>All objects have a statically determined "type" aka "tag", which is\r
1585 determined at object creation time, and which identifies the format of\r
1586 the object (i.e. how it is used, and how it can refer to other\r
1587 objects).  There are currently four different object types: "blob",\r
1588 "tree", "commit" and "tag".</p>\r
1589 <p>A "blob" object cannot refer to any other object, and is, like the type\r
1590 implies, a pure storage object containing some user data.  It is used to\r
1591 actually store the file data, i.e. a blob object is associated with some\r
1592 particular version of some file.</p>\r
1593 <p>A "tree" object is an object that ties one or more "blob" objects into a\r
1594 directory structure. In addition, a tree object can refer to other tree\r
1595 objects, thus creating a directory hierarchy.</p>\r
1596 <p>A "commit" object ties such directory hierarchies together into\r
1597 a DAG of revisions - each "commit" is associated with exactly one tree\r
1598 (the directory hierarchy at the time of the commit). In addition, a\r
1599 "commit" refers to one or more "parent" commit objects that describe the\r
1600 history of how we arrived at that directory hierarchy.</p>\r
1601 <p>As a special case, a commit object with no parents is called the "root"\r
1602 object, and is the point of an initial project commit.  Each project\r
1603 must have at least one root, and while you can tie several different\r
1604 root objects together into one project by creating a commit object which\r
1605 has two or more separate roots as its ultimate parents, that's probably\r
1606 just going to confuse people.  So aim for the notion of "one root object\r
1607 per project", even if git itself does not enforce that.</p>\r
1608 <p>A "tag" object symbolically identifies and can be used to sign other\r
1609 objects. It contains the identifier and type of another object, a\r
1610 symbolic name (of course!) and, optionally, a signature.</p>\r
1611 <p>Regardless of object type, all objects share the following\r
1612 characteristics: they are all deflated with zlib, and have a header\r
1613 that not only specifies their type, but also provides size information\r
1614 about the data in the object.  It's worth noting that the SHA1 hash\r
1615 that is used to name the object is the hash of the original data\r
1616 plus this header, so <tt>sha1sum</tt> <em>file</em> does not match the object name\r
1617 for <em>file</em>.\r
1618 (Historical note: in the dawn of the age of git the hash\r
1619 was the sha1 of the <em>compressed</em> object.)</p>\r
1620 <p>As a result, the general consistency of an object can always be tested\r
1621 independently of the contents or the type of the object: all objects can\r
1622 be validated by verifying that (a) their hashes match the content of the\r
1623 file and (b) the object successfully inflates to a stream of bytes that\r
1624 forms a sequence of &lt;ascii type without space&gt; + &lt;space&gt; + &lt;ascii decimal\r
1625 size&gt; + &lt;byte\0&gt; + &lt;binary object data&gt;.</p>\r
1626 <p>The structured objects can further have their structure and\r
1627 connectivity to other objects verified. This is generally done with\r
1628 the <tt>git-fsck-objects</tt> program, which generates a full dependency graph\r
1629 of all objects, and verifies their internal consistency (in addition\r
1630 to just verifying their superficial consistency through the hash).</p>\r
1631 <p>The object types in some more detail:</p>\r
1632 <h3>Blob Object</h3>\r
1633 <p>A "blob" object is nothing but a binary blob of data, and doesn't\r
1634 refer to anything else.  There is no signature or any other\r
1635 verification of the data, so while the object is consistent (it <em>is</em>\r
1636 indexed by its sha1 hash, so the data itself is certainly correct), it\r
1637 has absolutely no other attributes.  No name associations, no\r
1638 permissions.  It is purely a blob of data (i.e. normally "file\r
1639 contents").</p>\r
1640 <p>In particular, since the blob is entirely defined by its data, if two\r
1641 files in a directory tree (or in multiple different versions of the\r
1642 repository) have the same contents, they will share the same blob\r
1643 object. The object is totally independent of its location in the\r
1644 directory tree, and renaming a file does not change the object that\r
1645 file is associated with in any way.</p>\r
1646 <p>A blob is typically created when <a href="git-update-index.html">git-update-index(1)</a>\r
1647 is run, and its data can be accessed by <a href="git-cat-file.html">git-cat-file(1)</a>.</p>\r
1648 <h3>Tree Object</h3>\r
1649 <p>The next hierarchical object type is the "tree" object.  A tree object\r
1650 is a list of mode/name/blob data, sorted by name.  Alternatively, the\r
1651 mode data may specify a directory mode, in which case instead of\r
1652 naming a blob, that name is associated with another TREE object.</p>\r
1653 <p>Like the "blob" object, a tree object is uniquely determined by the\r
1654 set contents, and so two separate but identical trees will always\r
1655 share the exact same object. This is true at all levels, i.e. it's\r
1656 true for a "leaf" tree (which does not refer to any other trees, only\r
1657 blobs) as well as for a whole subdirectory.</p>\r
1658 <p>For that reason a "tree" object is just a pure data abstraction: it\r
1659 has no history, no signatures, no verification of validity, except\r
1660 that since the contents are again protected by the hash itself, we can\r
1661 trust that the tree is immutable and its contents never change.</p>\r
1662 <p>So you can trust the contents of a tree to be valid, the same way you\r
1663 can trust the contents of a blob, but you don't know where those\r
1664 contents <em>came</em> from.</p>\r
1665 <p>Side note on trees: since a "tree" object is a sorted list of\r
1666 "filename+content", you can create a diff between two trees without\r
1667 actually having to unpack two trees.  Just ignore all common parts,\r
1668 and your diff will look right.  In other words, you can effectively\r
1669 (and efficiently) tell the difference between any two random trees by\r
1670 O(n) where "n" is the size of the difference, rather than the size of\r
1671 the tree.</p>\r
1672 <p>Side note 2 on trees: since the name of a "blob" depends entirely and\r
1673 exclusively on its contents (i.e. there are no names or permissions\r
1674 involved), you can see trivial renames or permission changes by\r
1675 noticing that the blob stayed the same.  However, renames with data\r
1676 changes need a smarter "diff" implementation.</p>\r
1677 <p>A tree is created with <a href="git-write-tree.html">git-write-tree(1)</a> and\r
1678 its data can be accessed by <a href="git-ls-tree.html">git-ls-tree(1)</a>.\r
1679 Two trees can be compared with <a href="git-diff-tree.html">git-diff-tree(1)</a>.</p>\r
1680 <h3>Commit Object</h3>\r
1681 <p>The "commit" object is an object that introduces the notion of\r
1682 history into the picture.  In contrast to the other objects, it\r
1683 doesn't just describe the physical state of a tree, it describes how\r
1684 we got there, and why.</p>\r
1685 <p>A "commit" is defined by the tree-object that it results in, the\r
1686 parent commits (zero, one or more) that led up to that point, and a\r
1687 comment on what happened.  Again, a commit is not trusted per se:\r
1688 the contents are well-defined and "safe" due to the cryptographically\r
1689 strong signatures at all levels, but there is no reason to believe\r
1690 that the tree is "good" or that the merge information makes sense.\r
1691 The parents do not have to actually have any relationship with the\r
1692 result, for example.</p>\r
1693 <p>Note on commits: unlike real SCM's, commits do not contain\r
1694 rename information or file mode change information.  All of that is\r
1695 implicit in the trees involved (the result tree, and the result trees\r
1696 of the parents), and describing that makes no sense in this idiotic\r
1697 file manager.</p>\r
1698 <p>A commit is created with <a href="git-commit-tree.html">git-commit-tree(1)</a> and\r
1699 its data can be accessed by <a href="git-cat-file.html">git-cat-file(1)</a>.</p>\r
1700 <h3>Trust</h3>\r
1701 <p>An aside on the notion of "trust". Trust is really outside the scope\r
1702 of "git", but it's worth noting a few things.  First off, since\r
1703 everything is hashed with SHA1, you <em>can</em> trust that an object is\r
1704 intact and has not been messed with by external sources.  So the name\r
1705 of an object uniquely identifies a known state - just not a state that\r
1706 you may want to trust.</p>\r
1707 <p>Furthermore, since the SHA1 signature of a commit refers to the\r
1708 SHA1 signatures of the tree it is associated with and the signatures\r
1709 of the parent, a single named commit specifies uniquely a whole set\r
1710 of history, with full contents.  You can't later fake any step of the\r
1711 way once you have the name of a commit.</p>\r
1712 <p>So to introduce some real trust in the system, the only thing you need\r
1713 to do is to digitally sign just <em>one</em> special note, which includes the\r
1714 name of a top-level commit.  Your digital signature shows others\r
1715 that you trust that commit, and the immutability of the history of\r
1716 commits tells others that they can trust the whole history.</p>\r
1717 <p>In other words, you can easily validate a whole archive by just\r
1718 sending out a single email that tells the people the name (SHA1 hash)\r
1719 of the top commit, and digitally sign that email using something\r
1720 like GPG/PGP.</p>\r
1721 <p>To assist in this, git also provides the tag object&#8230;</p>\r
1722 <h3>Tag Object</h3>\r
1723 <p>Git provides the "tag" object to simplify creating, managing and\r
1724 exchanging symbolic and signed tokens.  The "tag" object at its\r
1725 simplest simply symbolically identifies another object by containing\r
1726 the sha1, type and symbolic name.</p>\r
1727 <p>However it can optionally contain additional signature information\r
1728 (which git doesn't care about as long as there's less than 8k of\r
1729 it). This can then be verified externally to git.</p>\r
1730 <p>Note that despite the tag features, "git" itself only handles content\r
1731 integrity; the trust framework (and signature provision and\r
1732 verification) has to come from outside.</p>\r
1733 <p>A tag is created with <a href="git-mktag.html">git-mktag(1)</a>,\r
1734 its data can be accessed by <a href="git-cat-file.html">git-cat-file(1)</a>,\r
1735 and the signature can be verified by\r
1736 <a href="git-verify-tag.html">git-verify-tag(1)</a>.</p>\r
1737 </div>\r
1738 <h2>The "index" aka "Current Directory Cache"</h2>\r
1739 <div class="sectionbody">\r
1740 <p>The index is a simple binary file, which contains an efficient\r
1741 representation of a virtual directory content at some random time.  It\r
1742 does so by a simple array that associates a set of names, dates,\r
1743 permissions and content (aka "blob") objects together.  The cache is\r
1744 always kept ordered by name, and names are unique (with a few very\r
1745 specific rules) at any point in time, but the cache has no long-term\r
1746 meaning, and can be partially updated at any time.</p>\r
1747 <p>In particular, the index certainly does not need to be consistent with\r
1748 the current directory contents (in fact, most operations will depend on\r
1749 different ways to make the index <em>not</em> be consistent with the directory\r
1750 hierarchy), but it has three very important attributes:</p>\r
1751 <p><em>(a) it can re-generate the full state it caches (not just the\r
1752 directory structure: it contains pointers to the "blob" objects so\r
1753 that it can regenerate the data too)</em></p>\r
1754 <p>As a special case, there is a clear and unambiguous one-way mapping\r
1755 from a current directory cache to a "tree object", which can be\r
1756 efficiently created from just the current directory cache without\r
1757 actually looking at any other data.  So a directory cache at any one\r
1758 time uniquely specifies one and only one "tree" object (but has\r
1759 additional data to make it easy to match up that tree object with what\r
1760 has happened in the directory)</p>\r
1761 <p><em>(b) it has efficient methods for finding inconsistencies between that\r
1762 cached state ("tree object waiting to be instantiated") and the\r
1763 current state.</em></p>\r
1764 <p><em>(c) it can additionally efficiently represent information about merge\r
1765 conflicts between different tree objects, allowing each pathname to be\r
1766 associated with sufficient information about the trees involved that\r
1767 you can create a three-way merge between them.</em></p>\r
1768 <p>Those are the three ONLY things that the directory cache does.  It's a\r
1769 cache, and the normal operation is to re-generate it completely from a\r
1770 known tree object, or update/compare it with a live tree that is being\r
1771 developed.  If you blow the directory cache away entirely, you generally\r
1772 haven't lost any information as long as you have the name of the tree\r
1773 that it described.</p>\r
1774 <p>At the same time, the index is at the same time also the\r
1775 staging area for creating new trees, and creating a new tree always\r
1776 involves a controlled modification of the index file.  In particular,\r
1777 the index file can have the representation of an intermediate tree that\r
1778 has not yet been instantiated.  So the index can be thought of as a\r
1779 write-back cache, which can contain dirty information that has not yet\r
1780 been written back to the backing store.</p>\r
1781 </div>\r
1782 <h2>The Workflow</h2>\r
1783 <div class="sectionbody">\r
1784 <p>Generally, all "git" operations work on the index file. Some operations\r
1785 work <strong>purely</strong> on the index file (showing the current state of the\r
1786 index), but most operations move data to and from the index file. Either\r
1787 from the database or from the working directory. Thus there are four\r
1788 main combinations:</p>\r
1789 <h3>1) working directory -&gt; index</h3>\r
1790 <p>You update the index with information from the working directory with\r
1791 the <a href="git-update-index.html">git-update-index(1)</a> command.  You\r
1792 generally update the index information by just specifying the filename\r
1793 you want to update, like so:</p>\r
1794 <div class="literalblock">\r
1795 <div class="content">\r
1796 <pre><tt>git-update-index filename</tt></pre>\r
1797 </div></div>\r
1798 <p>but to avoid common mistakes with filename globbing etc, the command\r
1799 will not normally add totally new entries or remove old entries,\r
1800 i.e. it will normally just update existing cache entries.</p>\r
1801 <p>To tell git that yes, you really do realize that certain files no\r
1802 longer exist, or that new files should be added, you\r
1803 should use the <tt>--remove</tt> and <tt>--add</tt> flags respectively.</p>\r
1804 <p>NOTE! A <tt>--remove</tt> flag does <em>not</em> mean that subsequent filenames will\r
1805 necessarily be removed: if the files still exist in your directory\r
1806 structure, the index will be updated with their new status, not\r
1807 removed. The only thing <tt>--remove</tt> means is that update-cache will be\r
1808 considering a removed file to be a valid thing, and if the file really\r
1809 does not exist any more, it will update the index accordingly.</p>\r
1810 <p>As a special case, you can also do <tt>git-update-index --refresh</tt>, which\r
1811 will refresh the "stat" information of each index to match the current\r
1812 stat information. It will <em>not</em> update the object status itself, and\r
1813 it will only update the fields that are used to quickly test whether\r
1814 an object still matches its old backing store object.</p>\r
1815 <h3>2) index -&gt; object database</h3>\r
1816 <p>You write your current index file to a "tree" object with the program</p>\r
1817 <div class="literalblock">\r
1818 <div class="content">\r
1819 <pre><tt>git-write-tree</tt></pre>\r
1820 </div></div>\r
1821 <p>that doesn't come with any options - it will just write out the\r
1822 current index into the set of tree objects that describe that state,\r
1823 and it will return the name of the resulting top-level tree. You can\r
1824 use that tree to re-generate the index at any time by going in the\r
1825 other direction:</p>\r
1826 <h3>3) object database -&gt; index</h3>\r
1827 <p>You read a "tree" file from the object database, and use that to\r
1828 populate (and overwrite - don't do this if your index contains any\r
1829 unsaved state that you might want to restore later!) your current\r
1830 index.  Normal operation is just</p>\r
1831 <div class="literalblock">\r
1832 <div class="content">\r
1833 <pre><tt>git-read-tree &lt;sha1 of tree&gt;</tt></pre>\r
1834 </div></div>\r
1835 <p>and your index file will now be equivalent to the tree that you saved\r
1836 earlier. However, that is only your <em>index</em> file: your working\r
1837 directory contents have not been modified.</p>\r
1838 <h3>4) index -&gt; working directory</h3>\r
1839 <p>You update your working directory from the index by "checking out"\r
1840 files. This is not a very common operation, since normally you'd just\r
1841 keep your files updated, and rather than write to your working\r
1842 directory, you'd tell the index files about the changes in your\r
1843 working directory (i.e. <tt>git-update-index</tt>).</p>\r
1844 <p>However, if you decide to jump to a new version, or check out somebody\r
1845 else's version, or just restore a previous tree, you'd populate your\r
1846 index file with read-tree, and then you need to check out the result\r
1847 with</p>\r
1848 <div class="literalblock">\r
1849 <div class="content">\r
1850 <pre><tt>git-checkout-index filename</tt></pre>\r
1851 </div></div>\r
1852 <p>or, if you want to check out all of the index, use <tt>-a</tt>.</p>\r
1853 <p>NOTE! git-checkout-index normally refuses to overwrite old files, so\r
1854 if you have an old version of the tree already checked out, you will\r
1855 need to use the "-f" flag (<em>before</em> the "-a" flag or the filename) to\r
1856 <em>force</em> the checkout.</p>\r
1857 <p>Finally, there are a few odds and ends which are not purely moving\r
1858 from one representation to the other:</p>\r
1859 <h3>5) Tying it all together</h3>\r
1860 <p>To commit a tree you have instantiated with "git-write-tree", you'd\r
1861 create a "commit" object that refers to that tree and the history\r
1862 behind it - most notably the "parent" commits that preceded it in\r
1863 history.</p>\r
1864 <p>Normally a "commit" has one parent: the previous state of the tree\r
1865 before a certain change was made. However, sometimes it can have two\r
1866 or more parent commits, in which case we call it a "merge", due to the\r
1867 fact that such a commit brings together ("merges") two or more\r
1868 previous states represented by other commits.</p>\r
1869 <p>In other words, while a "tree" represents a particular directory state\r
1870 of a working directory, a "commit" represents that state in "time",\r
1871 and explains how we got there.</p>\r
1872 <p>You create a commit object by giving it the tree that describes the\r
1873 state at the time of the commit, and a list of parents:</p>\r
1874 <div class="literalblock">\r
1875 <div class="content">\r
1876 <pre><tt>git-commit-tree &lt;tree&gt; -p &lt;parent&gt; [-p &lt;parent2&gt; ..]</tt></pre>\r
1877 </div></div>\r
1878 <p>and then giving the reason for the commit on stdin (either through\r
1879 redirection from a pipe or file, or by just typing it at the tty).</p>\r
1880 <p>git-commit-tree will return the name of the object that represents\r
1881 that commit, and you should save it away for later use. Normally,\r
1882 you'd commit a new <tt>HEAD</tt> state, and while git doesn't care where you\r
1883 save the note about that state, in practice we tend to just write the\r
1884 result to the file pointed at by <tt>.git/HEAD</tt>, so that we can always see\r
1885 what the last committed state was.</p>\r
1886 <p>Here is an ASCII art by Jon Loeliger that illustrates how\r
1887 various pieces fit together.</p>\r
1888 <div class="listingblock">\r
1889 <div class="content">\r
1890 <pre><tt>\r
1891                      commit-tree\r
1892                       commit obj\r
1893                        +----+\r
1894                        |    |\r
1895                        |    |\r
1896                        V    V\r
1897                     +-----------+\r
1898                     | Object DB |\r
1899                     |  Backing  |\r
1900                     |   Store   |\r
1901                     +-----------+\r
1902                        ^\r
1903            write-tree  |     |\r
1904              tree obj  |     |\r
1905                        |     |  read-tree\r
1906                        |     |  tree obj\r
1907                              V\r
1908                     +-----------+\r
1909                     |   Index   |\r
1910                     |  "cache"  |\r
1911                     +-----------+\r
1912          update-index  ^\r
1913              blob obj  |     |\r
1914                        |     |\r
1915     checkout-index -u  |     |  checkout-index\r
1916              stat      |     |  blob obj\r
1917                              V\r
1918                     +-----------+\r
1919                     |  Working  |\r
1920                     | Directory |\r
1921                     +-----------+\r
1922 </tt></pre>\r
1923 </div></div>\r
1924 <h3>6) Examining the data</h3>\r
1925 <p>You can examine the data represented in the object database and the\r
1926 index with various helper tools. For every object, you can use\r
1927 <a href="git-cat-file.html">git-cat-file(1)</a> to examine details about the\r
1928 object:</p>\r
1929 <div class="literalblock">\r
1930 <div class="content">\r
1931 <pre><tt>git-cat-file -t &lt;objectname&gt;</tt></pre>\r
1932 </div></div>\r
1933 <p>shows the type of the object, and once you have the type (which is\r
1934 usually implicit in where you find the object), you can use</p>\r
1935 <div class="literalblock">\r
1936 <div class="content">\r
1937 <pre><tt>git-cat-file blob|tree|commit|tag &lt;objectname&gt;</tt></pre>\r
1938 </div></div>\r
1939 <p>to show its contents. NOTE! Trees have binary content, and as a result\r
1940 there is a special helper for showing that content, called\r
1941 <tt>git-ls-tree</tt>, which turns the binary content into a more easily\r
1942 readable form.</p>\r
1943 <p>It's especially instructive to look at "commit" objects, since those\r
1944 tend to be small and fairly self-explanatory. In particular, if you\r
1945 follow the convention of having the top commit name in <tt>.git/HEAD</tt>,\r
1946 you can do</p>\r
1947 <div class="literalblock">\r
1948 <div class="content">\r
1949 <pre><tt>git-cat-file commit HEAD</tt></pre>\r
1950 </div></div>\r
1951 <p>to see what the top commit was.</p>\r
1952 <h3>7) Merging multiple trees</h3>\r
1953 <p>Git helps you do a three-way merge, which you can expand to n-way by\r
1954 repeating the merge procedure arbitrary times until you finally\r
1955 "commit" the state.  The normal situation is that you'd only do one\r
1956 three-way merge (two parents), and commit it, but if you like to, you\r
1957 can do multiple parents in one go.</p>\r
1958 <p>To do a three-way merge, you need the two sets of "commit" objects\r
1959 that you want to merge, use those to find the closest common parent (a\r
1960 third "commit" object), and then use those commit objects to find the\r
1961 state of the directory ("tree" object) at these points.</p>\r
1962 <p>To get the "base" for the merge, you first look up the common parent\r
1963 of two commits with</p>\r
1964 <div class="literalblock">\r
1965 <div class="content">\r
1966 <pre><tt>git-merge-base &lt;commit1&gt; &lt;commit2&gt;</tt></pre>\r
1967 </div></div>\r
1968 <p>which will return you the commit they are both based on.  You should\r
1969 now look up the "tree" objects of those commits, which you can easily\r
1970 do with (for example)</p>\r
1971 <div class="literalblock">\r
1972 <div class="content">\r
1973 <pre><tt>git-cat-file commit &lt;commitname&gt; | head -1</tt></pre>\r
1974 </div></div>\r
1975 <p>since the tree object information is always the first line in a commit\r
1976 object.</p>\r
1977 <p>Once you know the three trees you are going to merge (the one\r
1978 "original" tree, aka the common case, and the two "result" trees, aka\r
1979 the branches you want to merge), you do a "merge" read into the\r
1980 index. This will complain if it has to throw away your old index contents, so you should\r
1981 make sure that you've committed those - in fact you would normally\r
1982 always do a merge against your last commit (which should thus match\r
1983 what you have in your current index anyway).</p>\r
1984 <p>To do the merge, do</p>\r
1985 <div class="literalblock">\r
1986 <div class="content">\r
1987 <pre><tt>git-read-tree -m -u &lt;origtree&gt; &lt;yourtree&gt; &lt;targettree&gt;</tt></pre>\r
1988 </div></div>\r
1989 <p>which will do all trivial merge operations for you directly in the\r
1990 index file, and you can just write the result out with\r
1991 <tt>git-write-tree</tt>.</p>\r
1992 <p>Historical note.  We did not have <tt>-u</tt> facility when this\r
1993 section was first written, so we used to warn that\r
1994 the merge is done in the index file, not in your\r
1995 working tree, and your working tree will not match your\r
1996 index after this step.\r
1997 This is no longer true.  The above command, thanks to <tt>-u</tt>\r
1998 option, updates your working tree with the merge results for\r
1999 paths that have been trivially merged.</p>\r
2000 <h3>8) Merging multiple trees, continued</h3>\r
2001 <p>Sadly, many merges aren't trivial. If there are files that have\r
2002 been added.moved or removed, or if both branches have modified the\r
2003 same file, you will be left with an index tree that contains "merge\r
2004 entries" in it. Such an index tree can <em>NOT</em> be written out to a tree\r
2005 object, and you will have to resolve any such merge clashes using\r
2006 other tools before you can write out the result.</p>\r
2007 <p>You can examine such index state with <tt>git-ls-files --unmerged</tt>\r
2008 command.  An example:</p>\r
2009 <div class="listingblock">\r
2010 <div class="content">\r
2011 <pre><tt>$ git-read-tree -m $orig HEAD $target\r
2012 $ git-ls-files --unmerged\r
2013 100644 263414f423d0e4d70dae8fe53fa34614ff3e2860 1       hello.c\r
2014 100644 06fa6a24256dc7e560efa5687fa84b51f0263c3a 2       hello.c\r
2015 100644 cc44c73eb783565da5831b4d820c962954019b69 3       hello.c</tt></pre>\r
2016 </div></div>\r
2017 <p>Each line of the <tt>git-ls-files --unmerged</tt> output begins with\r
2018 the blob mode bits, blob SHA1, <em>stage number</em>, and the\r
2019 filename.  The <em>stage number</em> is git's way to say which tree it\r
2020 came from: stage 1 corresponds to <tt>$orig</tt> tree, stage 2 <tt>HEAD</tt>\r
2021 tree, and stage3 <tt>$target</tt> tree.</p>\r
2022 <p>Earlier we said that trivial merges are done inside\r
2023 <tt>git-read-tree -m</tt>.  For example, if the file did not change\r
2024 from <tt>$orig</tt> to <tt>HEAD</tt> nor <tt>$target</tt>, or if the file changed\r
2025 from <tt>$orig</tt> to <tt>HEAD</tt> and <tt>$orig</tt> to <tt>$target</tt> the same way,\r
2026 obviously the final outcome is what is in <tt>HEAD</tt>.  What the\r
2027 above example shows is that file <tt>hello.c</tt> was changed from\r
2028 <tt>$orig</tt> to <tt>HEAD</tt> and <tt>$orig</tt> to <tt>$target</tt> in a different way.\r
2029 You could resolve this by running your favorite 3-way merge\r
2030 program, e.g.  <tt>diff3</tt> or <tt>merge</tt>, on the blob objects from\r
2031 these three stages yourself, like this:</p>\r
2032 <div class="listingblock">\r
2033 <div class="content">\r
2034 <pre><tt>$ git-cat-file blob 263414f... &gt;hello.c~1\r
2035 $ git-cat-file blob 06fa6a2... &gt;hello.c~2\r
2036 $ git-cat-file blob cc44c73... &gt;hello.c~3\r
2037 $ merge hello.c~2 hello.c~1 hello.c~3</tt></pre>\r
2038 </div></div>\r
2039 <p>This would leave the merge result in <tt>hello.c~2</tt> file, along\r
2040 with conflict markers if there are conflicts.  After verifying\r
2041 the merge result makes sense, you can tell git what the final\r
2042 merge result for this file is by:</p>\r
2043 <div class="literalblock">\r
2044 <div class="content">\r
2045 <pre><tt>mv -f hello.c~2 hello.c\r
2046 git-update-index hello.c</tt></pre>\r
2047 </div></div>\r
2048 <p>When a path is in unmerged state, running <tt>git-update-index</tt> for\r
2049 that path tells git to mark the path resolved.</p>\r
2050 <p>The above is the description of a git merge at the lowest level,\r
2051 to help you understand what conceptually happens under the hood.\r
2052 In practice, nobody, not even git itself, uses three <tt>git-cat-file</tt>\r
2053 for this.  There is <tt>git-merge-index</tt> program that extracts the\r
2054 stages to temporary files and calls a "merge" script on it:</p>\r
2055 <div class="literalblock">\r
2056 <div class="content">\r
2057 <pre><tt>git-merge-index git-merge-one-file hello.c</tt></pre>\r
2058 </div></div>\r
2059 <p>and that is what higher level <tt>git resolve</tt> is implemented with.</p>\r
2060 </div>\r
2061 <h2>Authors</h2>\r
2062 <div class="sectionbody">\r
2063 <ul>\r
2064 <li>\r
2065 <p>\r
2066 git's founding father is Linus Torvalds &lt;torvalds@osdl.org&gt;.\r
2067 </p>\r
2068 </li>\r
2069 <li>\r
2070 <p>\r
2071 The current git nurse is Junio C Hamano &lt;junkio@cox.net&gt;.\r
2072 </p>\r
2073 </li>\r
2074 <li>\r
2075 <p>\r
2076 The git potty was written by Andres Ericsson &lt;ae@op5.se&gt;.\r
2077 </p>\r
2078 </li>\r
2079 <li>\r
2080 <p>\r
2081 General upbringing is handled by the git-list &lt;git@vger.kernel.org&gt;.\r
2082 </p>\r
2083 </li>\r
2084 </ul>\r
2085 </div>\r
2086 <h2>Documentation</h2>\r
2087 <div class="sectionbody">\r
2088 <p>The documentation for git suite was started by David Greaves\r
2089 &lt;david@dgreaves.com&gt;, and later enhanced greatly by the\r
2090 contributors on the git-list &lt;git@vger.kernel.org&gt;.</p>\r
2091 </div>\r
2092 <h2>GIT</h2>\r
2093 <div class="sectionbody">\r
2094 <p>Part of the <a href="git.html">git(7)</a> suite</p>\r
2095 </div>\r
2096 <div id="footer">\r
2097 <div id="footer-text">\r
2098 Last updated 18-Apr-2006 21:30:44 UTC\r
2099 </div>\r
2100 </div>\r
2101 </body>\r
2102 </html>\r