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