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