blob: 38bb715b90e4c452d370e4687636ef0f68d41b51 [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
Junio C Hamano8f62db92007-02-01 00:22:22287also want to read <a href="cvs-migration.html">CVS migration</a>.
288<a href="user-manual.html">Git User's Manual</a> is still work in
289progress, but when finished hopefully it will guide a new user
290in a coherent way to git enlightenment ;-).</p>
Junio C Hamano33db4372006-06-07 19:51:45291<p>The COMMAND is either a name of a Git command (see below) or an alias
Junio C Hamano7ad22dc2007-01-29 02:55:48292as defined in the configuration file (see <a href="git-config.html">git-config(1)</a>).</p>
Junio C Hamano1a4e8412005-12-27 08:17:23293</div>
294<h2>OPTIONS</h2>
295<div class="sectionbody">
296<dl>
297<dt>
298--version
299</dt>
300<dd>
301<p>
Junio C Hamano01078922006-03-10 00:31:47302 Prints the git suite version that the <em>git</em> program came from.
Junio C Hamano1a4e8412005-12-27 08:17:23303</p>
304</dd>
305<dt>
306--help
307</dt>
308<dd>
309<p>
Junio C Hamano01078922006-03-10 00:31:47310 Prints the synopsis and a list of the most commonly used
311 commands. If a git command is named this option will bring up
312 the man-page for that command. If the option <em>--all</em> or <em>-a</em> is
313 given then all available commands are printed.
Junio C Hamano1a4e8412005-12-27 08:17:23314</p>
315</dd>
316<dt>
317--exec-path
318</dt>
319<dd>
320<p>
Junio C Hamano01078922006-03-10 00:31:47321 Path to wherever your core git programs are installed.
Junio C Hamano1a4e8412005-12-27 08:17:23322 This can also be controlled by setting the GIT_EXEC_PATH
323 environment variable. If no path is given <em>git</em> will print
324 the current setting and then exit.
325</p>
326</dd>
Junio C Hamanof870ef82006-07-29 09:10:13327<dt>
328-p|--paginate
329</dt>
330<dd>
331<p>
332 Pipe all output into <em>less</em> (or if set, $PAGER).
333</p>
334</dd>
335<dt>
336--git-dir=&lt;path&gt;
337</dt>
338<dd>
339<p>
340 Set the path to the repository. This can also be controlled by
341 setting the GIT_DIR environment variable.
342</p>
343</dd>
344<dt>
345--bare
346</dt>
347<dd>
348<p>
349 Same as --git-dir=<tt>pwd</tt>.
350</p>
351</dd>
Junio C Hamano1a4e8412005-12-27 08:17:23352</dl>
353</div>
Junio C Hamanoe27fb932006-04-03 05:34:10354<h2>FURTHER DOCUMENTATION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23355<div class="sectionbody">
Junio C Hamanoe27fb932006-04-03 05:34:10356<p>See the references above to get started using git. The following is
357probably more detail than necessary for a first-time user.</p>
358<p>The <a href="#Discussion">Discussion</a> section below and the
359<a href="core-tutorial.html">Core tutorial</a> both provide introductions to the
360underlying git architecture.</p>
361<p>See also the <a href="howto-index.html">howto</a> documents for some useful
362examples.</p>
Junio C Hamano1a4e8412005-12-27 08:17:23363</div>
Junio C Hamanoe27fb932006-04-03 05:34:10364<h2>GIT COMMANDS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23365<div class="sectionbody">
Junio C Hamanoe27fb932006-04-03 05:34:10366<p>We divide git into high level ("porcelain") commands and low level
367("plumbing") commands.</p>
Junio C Hamano1a4e8412005-12-27 08:17:23368</div>
Junio C Hamanoe27fb932006-04-03 05:34:10369<h2>High-level commands (porcelain)</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23370<div class="sectionbody">
Junio C Hamanoe27fb932006-04-03 05:34:10371<p>We separate the porcelain commands into the main commands and some
372ancillary user utilities.</p>
373<h3>Main porcelain commands</h3>
Junio C Hamano1a4e8412005-12-27 08:17:23374<dl>
375<dt>
376<a href="git-add.html">git-add(1)</a>
377</dt>
378<dd>
379<p>
Junio C Hamano7c73c662007-01-19 00:37:50380 Add file contents to the changeset to be committed next.
Junio C Hamano1a4e8412005-12-27 08:17:23381</p>
382</dd>
383<dt>
384<a href="git-am.html">git-am(1)</a>
385</dt>
386<dd>
387<p>
Junio C Hamano7c73c662007-01-19 00:37:50388 Apply a series of patches from a mailbox.
Junio C Hamano1a4e8412005-12-27 08:17:23389</p>
390</dd>
391<dt>
Junio C Hamano817abb42006-09-26 07:16:58392<a href="git-archive.html">git-archive(1)</a>
393</dt>
394<dd>
395<p>
396 Creates an archive of files from a named tree.
397</p>
398</dd>
399<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23400<a href="git-bisect.html">git-bisect(1)</a>
401</dt>
402<dd>
403<p>
404 Find the change that introduced a bug by binary search.
405</p>
406</dd>
407<dt>
408<a href="git-branch.html">git-branch(1)</a>
409</dt>
410<dd>
411<p>
Junio C Hamano7c73c662007-01-19 00:37:50412 List, create, or delete branches.
Junio C Hamano1a4e8412005-12-27 08:17:23413</p>
414</dd>
415<dt>
Junio C Hamano6ac2f142007-03-01 01:24:56416<a href="git-bundle.html">git-bundle(1)</a>
417</dt>
418<dd>
419<p>
420 Move objects and refs by archive.
421</p>
422</dd>
423<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23424<a href="git-checkout.html">git-checkout(1)</a>
425</dt>
426<dd>
427<p>
428 Checkout and switch to a branch.
429</p>
430</dd>
431<dt>
432<a href="git-cherry-pick.html">git-cherry-pick(1)</a>
433</dt>
434<dd>
435<p>
Junio C Hamano7c73c662007-01-19 00:37:50436 Apply the change introduced by an existing commit.
Junio C Hamano1a4e8412005-12-27 08:17:23437</p>
438</dd>
439<dt>
Junio C Hamano54559c82006-04-13 07:45:12440<a href="git-clean.html">git-clean(1)</a>
441</dt>
442<dd>
443<p>
444 Remove untracked files from the working tree.
445</p>
446</dd>
447<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23448<a href="git-clone.html">git-clone(1)</a>
449</dt>
450<dd>
451<p>
452 Clones a repository into a new directory.
453</p>
454</dd>
455<dt>
456<a href="git-commit.html">git-commit(1)</a>
457</dt>
458<dd>
459<p>
460 Record changes to the repository.
461</p>
462</dd>
463<dt>
Junio C Hamano4ad294b2007-01-20 02:22:50464<a href="git-describe.html">git-describe(1)</a>
465</dt>
466<dd>
467<p>
468 Show the most recent tag that is reachable from a commit.
469</p>
470</dd>
471<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23472<a href="git-diff.html">git-diff(1)</a>
473</dt>
474<dd>
475<p>
476 Show changes between commits, commit and working tree, etc.
477</p>
478</dd>
479<dt>
480<a href="git-fetch.html">git-fetch(1)</a>
481</dt>
482<dd>
483<p>
Junio C Hamano7c73c662007-01-19 00:37:50484 Download objects and refs from another repository.
Junio C Hamano1a4e8412005-12-27 08:17:23485</p>
486</dd>
487<dt>
488<a href="git-format-patch.html">git-format-patch(1)</a>
489</dt>
490<dd>
491<p>
492 Prepare patches for e-mail submission.
493</p>
494</dd>
495<dt>
Junio C Hamano4ad294b2007-01-20 02:22:50496<a href="git-gc.html">git-gc(1)</a>
497</dt>
498<dd>
499<p>
500 Cleanup unnecessary files and optimize the local repository.
501</p>
502</dd>
503<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23504<a href="git-grep.html">git-grep(1)</a>
505</dt>
506<dd>
507<p>
508 Print lines matching a pattern.
509</p>
510</dd>
511<dt>
Junio C Hamano4ad294b2007-01-20 02:22:50512<a href="git-init.html">git-init(1)</a>
513</dt>
514<dd>
515<p>
516 Create an empty git repository or reinitialize an existing one.
517</p>
518</dd>
519<dt>
Junio C Hamanoeb8e3572006-09-01 08:25:07520<a href="gitk.html">gitk(1)</a>
521</dt>
522<dd>
523<p>
524 The git repository browser.
525</p>
526</dd>
527<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23528<a href="git-log.html">git-log(1)</a>
529</dt>
530<dd>
531<p>
Junio C Hamano7c73c662007-01-19 00:37:50532 Show commit logs.
Junio C Hamano1a4e8412005-12-27 08:17:23533</p>
534</dd>
535<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23536<a href="git-merge.html">git-merge(1)</a>
537</dt>
538<dd>
539<p>
Junio C Hamano7c73c662007-01-19 00:37:50540 Join two or more development histories together.
Junio C Hamano1a4e8412005-12-27 08:17:23541</p>
542</dd>
543<dt>
544<a href="git-mv.html">git-mv(1)</a>
545</dt>
546<dd>
547<p>
548 Move or rename a file, a directory, or a symlink.
549</p>
550</dd>
551<dt>
552<a href="git-pull.html">git-pull(1)</a>
553</dt>
554<dd>
555<p>
Junio C Hamano7c73c662007-01-19 00:37:50556 Fetch from and merge with another repository or a local branch.
Junio C Hamano1a4e8412005-12-27 08:17:23557</p>
558</dd>
559<dt>
560<a href="git-push.html">git-push(1)</a>
561</dt>
562<dd>
563<p>
564 Update remote refs along with associated objects.
565</p>
566</dd>
567<dt>
568<a href="git-rebase.html">git-rebase(1)</a>
569</dt>
570<dd>
571<p>
Junio C Hamano7c73c662007-01-19 00:37:50572 Forward-port local commits to the updated upstream head.
Junio C Hamano1a4e8412005-12-27 08:17:23573</p>
574</dd>
575<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23576<a href="git-reset.html">git-reset(1)</a>
577</dt>
578<dd>
579<p>
580 Reset current HEAD to the specified state.
581</p>
582</dd>
583<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23584<a href="git-revert.html">git-revert(1)</a>
585</dt>
586<dd>
587<p>
588 Revert an existing commit.
589</p>
590</dd>
591<dt>
Junio C Hamano54559c82006-04-13 07:45:12592<a href="git-rm.html">git-rm(1)</a>
593</dt>
594<dd>
595<p>
596 Remove files from the working tree and from the index.
597</p>
598</dd>
599<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23600<a href="git-shortlog.html">git-shortlog(1)</a>
601</dt>
602<dd>
603<p>
Junio C Hamano7c73c662007-01-19 00:37:50604 Summarize <em>git log</em> output.
Junio C Hamano1a4e8412005-12-27 08:17:23605</p>
606</dd>
607<dt>
Junio C Hamano2b135272006-03-18 07:45:42608<a href="git-show.html">git-show(1)</a>
609</dt>
610<dd>
611<p>
Junio C Hamano7c73c662007-01-19 00:37:50612 Show various types of objects.
Junio C Hamano2b135272006-03-18 07:45:42613</p>
614</dd>
615<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23616<a href="git-status.html">git-status(1)</a>
617</dt>
618<dd>
619<p>
Junio C Hamano7c73c662007-01-19 00:37:50620 Show the working tree status.
Junio C Hamano1a4e8412005-12-27 08:17:23621</p>
622</dd>
623<dt>
Junio C Hamano4ad294b2007-01-20 02:22:50624<a href="git-tag.html">git-tag(1)</a>
625</dt>
626<dd>
627<p>
Junio C Hamanodb450ba2007-01-21 08:57:14628 Create, list, delete or verify a tag object signed with GPG.
Junio C Hamano4ad294b2007-01-20 02:22:50629</p>
630</dd>
631</dl>
632<h3>Ancillary Commands</h3>
633<p>Manipulators:</p>
634<dl>
635<dt>
636<a href="git-convert-objects.html">git-convert-objects(1)</a>
637</dt>
638<dd>
639<p>
640 Converts old-style git repository.
641</p>
642</dd>
643<dt>
Junio C Hamanodfc4ce72007-02-07 23:17:29644<a href="git-fast-import.html">git-fast-import(1)</a>
645</dt>
646<dd>
647<p>
Junio C Hamano053827f2007-02-14 07:23:58648 Backend for fast Git data importers.
Junio C Hamanodfc4ce72007-02-07 23:17:29649</p>
650</dd>
651<dt>
Junio C Hamano4ad294b2007-01-20 02:22:50652<a href="git-lost-found.html">git-lost-found(1)</a>
653</dt>
654<dd>
655<p>
656 Recover lost refs that luckily have not yet been pruned.
657</p>
658</dd>
659<dt>
Junio C Hamano103ad7f2007-03-14 11:19:26660<a href="git-mergetool.html">git-mergetool(1)</a>
661</dt>
662<dd>
663<p>
664 Run merge conflict resolution tools to resolve merge conflicts.
665</p>
666</dd>
667<dt>
Junio C Hamano4ad294b2007-01-20 02:22:50668<a href="git-pack-refs.html">git-pack-refs(1)</a>
669</dt>
670<dd>
671<p>
672 Pack heads and tags for efficient repository access.
673</p>
674</dd>
675<dt>
676<a href="git-prune.html">git-prune(1)</a>
677</dt>
678<dd>
679<p>
680 Prunes all unreachable objects from the object database.
681</p>
682</dd>
683<dt>
684<a href="git-reflog.html">git-reflog(1)</a>
685</dt>
686<dd>
687<p>
688 Manage reflog information.
689</p>
690</dd>
691<dt>
692<a href="git-relink.html">git-relink(1)</a>
693</dt>
694<dd>
695<p>
696 Hardlink common objects in local repositories.
697</p>
698</dd>
699<dt>
700<a href="git-repack.html">git-repack(1)</a>
701</dt>
702<dd>
703<p>
704 Pack unpacked objects in a repository.
705</p>
706</dd>
707<dt>
Junio C Hamano7ad22dc2007-01-29 02:55:48708<a href="git-config.html">git-config(1)</a>
Junio C Hamano4ad294b2007-01-20 02:22:50709</dt>
710<dd>
711<p>
712 Get and set repository or global options.
713</p>
714</dd>
Junio C Hamano053827f2007-02-14 07:23:58715<dt>
716<a href="git-remote.html">git-remote(1)</a>
717</dt>
718<dd>
719<p>
720 manage set of tracked repositories.
721</p>
722</dd>
Junio C Hamano4ad294b2007-01-20 02:22:50723</dl>
724<p>Interrogators:</p>
725<dl>
726<dt>
727<a href="git-annotate.html">git-annotate(1)</a>
728</dt>
729<dd>
730<p>
731 Annotate file lines with commit info.
732</p>
733</dd>
734<dt>
735<a href="git-applymbox.html">git-applymbox(1)</a>
736</dt>
737<dd>
738<p>
739 Apply a series of patches in a mailbox.
740</p>
741</dd>
742<dt>
743<a href="git-blame.html">git-blame(1)</a>
744</dt>
745<dd>
746<p>
747 Show what revision and author last modified each line of a file.
748</p>
749</dd>
750<dt>
751<a href="git-cherry.html">git-cherry(1)</a>
752</dt>
753<dd>
754<p>
755 Find commits not merged upstream.
756</p>
757</dd>
758<dt>
759<a href="git-count-objects.html">git-count-objects(1)</a>
760</dt>
761<dd>
762<p>
763 Count unpacked number of objects and their disk consumption.
764</p>
765</dd>
766<dt>
Junio C Hamano7ad22dc2007-01-29 02:55:48767<a href="git-fsck.html">git-fsck(1)</a>
Junio C Hamano4ad294b2007-01-20 02:22:50768</dt>
769<dd>
770<p>
771 Verifies the connectivity and validity of the objects in the database.
772</p>
773</dd>
774<dt>
775<a href="git-get-tar-commit-id.html">git-get-tar-commit-id(1)</a>
776</dt>
777<dd>
778<p>
779 Extract commit ID from an archive created using git-tar-tree.
780</p>
781</dd>
782<dt>
783<a href="git-instaweb.html">git-instaweb(1)</a>
784</dt>
785<dd>
786<p>
787 Instantly browse your working repository in gitweb.
788</p>
789</dd>
790<dt>
791<a href="git-merge-tree.html">git-merge-tree(1)</a>
792</dt>
793<dd>
794<p>
795 Show three-way merge without touching index.
796</p>
797</dd>
798<dt>
799<a href="git-rerere.html">git-rerere(1)</a>
800</dt>
801<dd>
802<p>
803 Reuse recorded resolution of conflicted merges.
804</p>
805</dd>
806<dt>
807<a href="git-rev-parse.html">git-rev-parse(1)</a>
808</dt>
809<dd>
810<p>
811 Pick out and massage parameters.
812</p>
813</dd>
814<dt>
815<a href="git-runstatus.html">git-runstatus(1)</a>
816</dt>
817<dd>
818<p>
819 A helper for git-status and git-commit.
820</p>
821</dd>
822<dt>
823<a href="git-show-branch.html">git-show-branch(1)</a>
824</dt>
825<dd>
826<p>
827 Show branches and their commits.
828</p>
829</dd>
830<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23831<a href="git-verify-tag.html">git-verify-tag(1)</a>
832</dt>
833<dd>
834<p>
835 Check the GPG signature of tag.
836</p>
837</dd>
838<dt>
839<a href="git-whatchanged.html">git-whatchanged(1)</a>
840</dt>
841<dd>
842<p>
Junio C Hamano7c73c662007-01-19 00:37:50843 Show logs with difference each commit introduces.
Junio C Hamano1a4e8412005-12-27 08:17:23844</p>
845</dd>
846</dl>
Junio C Hamano4ad294b2007-01-20 02:22:50847<h3>Interacting with Others</h3>
848<p>These commands are to interact with foreign SCM and with other
849people via patch over e-mail.</p>
Junio C Hamano1a4e8412005-12-27 08:17:23850<dl>
851<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23852<a href="git-archimport.html">git-archimport(1)</a>
853</dt>
854<dd>
855<p>
Junio C Hamano7c73c662007-01-19 00:37:50856 Import an Arch repository into git.
Junio C Hamano1a4e8412005-12-27 08:17:23857</p>
858</dd>
859<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23860<a href="git-cvsexportcommit.html">git-cvsexportcommit(1)</a>
861</dt>
862<dd>
863<p>
864 Export a single commit to a CVS checkout.
865</p>
866</dd>
867<dt>
Junio C Hamano7c73c662007-01-19 00:37:50868<a href="git-cvsimport.html">git-cvsimport(1)</a>
869</dt>
870<dd>
871<p>
872 Salvage your data out of another SCM people love to hate.
873</p>
874</dd>
875<dt>
Junio C Hamano54559c82006-04-13 07:45:12876<a href="git-cvsserver.html">git-cvsserver(1)</a>
877</dt>
878<dd>
879<p>
880 A CVS server emulator for git.
881</p>
882</dd>
883<dt>
Junio C Hamano4ad294b2007-01-20 02:22:50884<a href="git-imap-send.html">git-imap-send(1)</a>
Junio C Hamano52299462006-12-28 00:59:38885</dt>
886<dd>
887<p>
Junio C Hamano4ad294b2007-01-20 02:22:50888 Dump a mailbox from stdin into an imap folder.
Junio C Hamano1a4e8412005-12-27 08:17:23889</p>
890</dd>
891<dt>
Junio C Hamano33db4372006-06-07 19:51:45892<a href="git-quiltimport.html">git-quiltimport(1)</a>
893</dt>
894<dd>
895<p>
896 Applies a quilt patchset onto the current branch.
897</p>
898</dd>
899<dt>
Junio C Hamano4ad294b2007-01-20 02:22:50900<a href="git-request-pull.html">git-request-pull(1)</a>
Junio C Hamano74640642006-12-27 10:59:55901</dt>
902<dd>
903<p>
Junio C Hamano4ad294b2007-01-20 02:22:50904 Generates a summary of pending changes.
Junio C Hamano74640642006-12-27 10:59:55905</p>
906</dd>
907<dt>
Junio C Hamano4ad294b2007-01-20 02:22:50908<a href="git-send-email.html">git-send-email(1)</a>
Junio C Hamano1a4e8412005-12-27 08:17:23909</dt>
910<dd>
911<p>
Junio C Hamano4ad294b2007-01-20 02:22:50912 Send a collection of patches as emails.
Junio C Hamano7c73c662007-01-19 00:37:50913</p>
914</dd>
915<dt>
Junio C Hamanob518f452006-08-04 00:18:06916<a href="git-svn.html">git-svn(1)</a>
917</dt>
918<dd>
919<p>
920 Bidirectional operation between a single Subversion branch and git.
921</p>
922</dd>
923<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23924<a href="git-svnimport.html">git-svnimport(1)</a>
925</dt>
926<dd>
927<p>
928 Import a SVN repository into git.
929</p>
930</dd>
Junio C Hamano1a4e8412005-12-27 08:17:23931</dl>
932</div>
Junio C Hamanob19b4f02006-10-29 20:47:22933<h2>Low-level commands (plumbing)</h2>
934<div class="sectionbody">
935<p>Although git includes its
936own porcelain layer, its low-level commands are sufficient to support
937development of alternative porcelains. Developers of such porcelains
938might start by reading about <a href="git-update-index.html">git-update-index(1)</a> and
939<a href="git-read-tree.html">git-read-tree(1)</a>.</p>
Junio C Hamano4ad294b2007-01-20 02:22:50940<p>The interface (input, output, set of options and the semantics)
941to these low-level commands are meant to be a lot more stable
942than Porcelain level commands, because these commands are
943primarily for scripted use. The interface to Porcelain commands
944on the other hand are subject to change in order to improve the
945end user experience.</p>
946<p>The following description divides
947the low-level commands into commands that manipulate objects (in
Junio C Hamanob19b4f02006-10-29 20:47:22948the repository, index, and working tree), commands that interrogate and
949compare objects, and commands that move objects and references between
950repositories.</p>
951<h3>Manipulation commands</h3>
952<dl>
953<dt>
954<a href="git-apply.html">git-apply(1)</a>
955</dt>
956<dd>
957<p>
Junio C Hamano7c73c662007-01-19 00:37:50958 Apply a patch on a git index file and a working tree.
Junio C Hamanob19b4f02006-10-29 20:47:22959</p>
960</dd>
961<dt>
962<a href="git-checkout-index.html">git-checkout-index(1)</a>
963</dt>
964<dd>
965<p>
966 Copy files from the index to the working tree.
967</p>
968</dd>
969<dt>
970<a href="git-commit-tree.html">git-commit-tree(1)</a>
971</dt>
972<dd>
973<p>
Junio C Hamano7c73c662007-01-19 00:37:50974 Create a new commit object.
Junio C Hamanob19b4f02006-10-29 20:47:22975</p>
976</dd>
977<dt>
978<a href="git-hash-object.html">git-hash-object(1)</a>
979</dt>
980<dd>
981<p>
Junio C Hamano7c73c662007-01-19 00:37:50982 Compute object ID and optionally creates a blob from a file.
Junio C Hamanob19b4f02006-10-29 20:47:22983</p>
984</dd>
985<dt>
986<a href="git-index-pack.html">git-index-pack(1)</a>
987</dt>
988<dd>
989<p>
Junio C Hamano7c73c662007-01-19 00:37:50990 Build pack index file for an existing packed archive.
Junio C Hamanob19b4f02006-10-29 20:47:22991</p>
992</dd>
993<dt>
Junio C Hamano1de7bc62006-12-17 19:31:54994<a href="git-merge-file.html">git-merge-file(1)</a>
995</dt>
996<dd>
997<p>
Junio C Hamano7c73c662007-01-19 00:37:50998 Run a three-way file merge.
Junio C Hamano1de7bc62006-12-17 19:31:54999</p>
1000</dd>
1001<dt>
Junio C Hamanob19b4f02006-10-29 20:47:221002<a href="git-merge-index.html">git-merge-index(1)</a>
1003</dt>
1004<dd>
1005<p>
Junio C Hamano7c73c662007-01-19 00:37:501006 Run a merge for files needing merging.
Junio C Hamanob19b4f02006-10-29 20:47:221007</p>
1008</dd>
1009<dt>
1010<a href="git-mktag.html">git-mktag(1)</a>
1011</dt>
1012<dd>
1013<p>
1014 Creates a tag object.
1015</p>
1016</dd>
1017<dt>
1018<a href="git-mktree.html">git-mktree(1)</a>
1019</dt>
1020<dd>
1021<p>
1022 Build a tree-object from ls-tree formatted text.
1023</p>
1024</dd>
1025<dt>
1026<a href="git-pack-objects.html">git-pack-objects(1)</a>
1027</dt>
1028<dd>
1029<p>
Junio C Hamano7c73c662007-01-19 00:37:501030 Create a packed archive of objects.
Junio C Hamanob19b4f02006-10-29 20:47:221031</p>
1032</dd>
1033<dt>
1034<a href="git-prune-packed.html">git-prune-packed(1)</a>
1035</dt>
1036<dd>
1037<p>
1038 Remove extra objects that are already in pack files.
1039</p>
1040</dd>
1041<dt>
1042<a href="git-read-tree.html">git-read-tree(1)</a>
1043</dt>
1044<dd>
1045<p>
1046 Reads tree information into the index.
1047</p>
1048</dd>
1049<dt>
Junio C Hamano4ad294b2007-01-20 02:22:501050<a href="git-symbolic-ref.html">git-symbolic-ref(1)</a>
Junio C Hamanob19b4f02006-10-29 20:47:221051</dt>
1052<dd>
1053<p>
Junio C Hamano4ad294b2007-01-20 02:22:501054 Read and modify symbolic refs.
Junio C Hamanob19b4f02006-10-29 20:47:221055</p>
1056</dd>
1057<dt>
1058<a href="git-unpack-objects.html">git-unpack-objects(1)</a>
1059</dt>
1060<dd>
1061<p>
Junio C Hamano7c73c662007-01-19 00:37:501062 Unpack objects from a packed archive.
Junio C Hamanob19b4f02006-10-29 20:47:221063</p>
1064</dd>
1065<dt>
1066<a href="git-update-index.html">git-update-index(1)</a>
1067</dt>
1068<dd>
1069<p>
Junio C Hamano7c73c662007-01-19 00:37:501070 Register file contents in the working tree to the index.
Junio C Hamanob19b4f02006-10-29 20:47:221071</p>
1072</dd>
1073<dt>
Junio C Hamano4ad294b2007-01-20 02:22:501074<a href="git-update-ref.html">git-update-ref(1)</a>
1075</dt>
1076<dd>
1077<p>
1078 Update the object name stored in a ref safely.
1079</p>
1080</dd>
1081<dt>
Junio C Hamanob19b4f02006-10-29 20:47:221082<a href="git-write-tree.html">git-write-tree(1)</a>
1083</dt>
1084<dd>
1085<p>
Junio C Hamano7c73c662007-01-19 00:37:501086 Create a tree object from the current index.
Junio C Hamanob19b4f02006-10-29 20:47:221087</p>
1088</dd>
1089</dl>
1090<h3>Interrogation commands</h3>
1091<dl>
1092<dt>
1093<a href="git-cat-file.html">git-cat-file(1)</a>
1094</dt>
1095<dd>
1096<p>
1097 Provide content or type/size information for repository objects.
1098</p>
1099</dd>
1100<dt>
Junio C Hamanob19b4f02006-10-29 20:47:221101<a href="git-diff-files.html">git-diff-files(1)</a>
1102</dt>
1103<dd>
1104<p>
1105 Compares files in the working tree and the index.
1106</p>
1107</dd>
1108<dt>
Junio C Hamano7c73c662007-01-19 00:37:501109<a href="git-diff-index.html">git-diff-index(1)</a>
1110</dt>
1111<dd>
1112<p>
1113 Compares content and mode of blobs between the index and repository.
1114</p>
1115</dd>
1116<dt>
Junio C Hamanob19b4f02006-10-29 20:47:221117<a href="git-diff-tree.html">git-diff-tree(1)</a>
1118</dt>
1119<dd>
1120<p>
1121 Compares the content and mode of blobs found via two tree objects.
1122</p>
1123</dd>
1124<dt>
1125<a href="git-for-each-ref.html">git-for-each-ref(1)</a>
1126</dt>
1127<dd>
1128<p>
1129 Output information on each ref.
1130</p>
1131</dd>
1132<dt>
Junio C Hamanob19b4f02006-10-29 20:47:221133<a href="git-ls-files.html">git-ls-files(1)</a>
1134</dt>
1135<dd>
1136<p>
Junio C Hamano7c73c662007-01-19 00:37:501137 Show information about files in the index and the working tree.
Junio C Hamanob19b4f02006-10-29 20:47:221138</p>
1139</dd>
1140<dt>
Junio C Hamano4ad294b2007-01-20 02:22:501141<a href="git-ls-remote.html">git-ls-remote(1)</a>
1142</dt>
1143<dd>
1144<p>
1145 List references in a remote repository.
1146</p>
1147</dd>
1148<dt>
Junio C Hamanob19b4f02006-10-29 20:47:221149<a href="git-ls-tree.html">git-ls-tree(1)</a>
1150</dt>
1151<dd>
1152<p>
Junio C Hamano7c73c662007-01-19 00:37:501153 List the contents of a tree object.
Junio C Hamanob19b4f02006-10-29 20:47:221154</p>
1155</dd>
1156<dt>
1157<a href="git-merge-base.html">git-merge-base(1)</a>
1158</dt>
1159<dd>
1160<p>
Junio C Hamano7c73c662007-01-19 00:37:501161 Find as good common ancestors as possible for a merge.
Junio C Hamanob19b4f02006-10-29 20:47:221162</p>
1163</dd>
1164<dt>
1165<a href="git-name-rev.html">git-name-rev(1)</a>
1166</dt>
1167<dd>
1168<p>
1169 Find symbolic names for given revs.
1170</p>
1171</dd>
1172<dt>
1173<a href="git-pack-redundant.html">git-pack-redundant(1)</a>
1174</dt>
1175<dd>
1176<p>
1177 Find redundant pack files.
1178</p>
1179</dd>
1180<dt>
1181<a href="git-rev-list.html">git-rev-list(1)</a>
1182</dt>
1183<dd>
1184<p>
1185 Lists commit objects in reverse chronological order.
1186</p>
1187</dd>
1188<dt>
1189<a href="git-show-index.html">git-show-index(1)</a>
1190</dt>
1191<dd>
1192<p>
Junio C Hamano7c73c662007-01-19 00:37:501193 Show packed archive index.
Junio C Hamanob19b4f02006-10-29 20:47:221194</p>
1195</dd>
1196<dt>
Junio C Hamanod8c9d432006-11-07 07:19:131197<a href="git-show-ref.html">git-show-ref(1)</a>
1198</dt>
1199<dd>
1200<p>
1201 List references in a local repository.
1202</p>
1203</dd>
1204<dt>
Junio C Hamanob19b4f02006-10-29 20:47:221205<a href="git-tar-tree.html">git-tar-tree(1)</a>
1206</dt>
1207<dd>
1208<p>
Junio C Hamano7c73c662007-01-19 00:37:501209 Create a tar archive of the files in the named tree object.
Junio C Hamanob19b4f02006-10-29 20:47:221210</p>
1211</dd>
1212<dt>
1213<a href="git-unpack-file.html">git-unpack-file(1)</a>
1214</dt>
1215<dd>
1216<p>
1217 Creates a temporary file with a blob's contents.
1218</p>
1219</dd>
1220<dt>
1221<a href="git-var.html">git-var(1)</a>
1222</dt>
1223<dd>
1224<p>
Junio C Hamano7c73c662007-01-19 00:37:501225 Show a git logical variable.
Junio C Hamanob19b4f02006-10-29 20:47:221226</p>
1227</dd>
1228<dt>
1229<a href="git-verify-pack.html">git-verify-pack(1)</a>
1230</dt>
1231<dd>
1232<p>
Junio C Hamano7c73c662007-01-19 00:37:501233 Validate packed git archive files.
Junio C Hamanob19b4f02006-10-29 20:47:221234</p>
1235</dd>
1236</dl>
1237<p>In general, the interrogate commands do not touch the files in
1238the working tree.</p>
1239<h3>Synching repositories</h3>
1240<dl>
1241<dt>
Junio C Hamano4ad294b2007-01-20 02:22:501242<a href="git-daemon.html">git-daemon(1)</a>
1243</dt>
1244<dd>
1245<p>
1246 A really simple server for git repositories.
1247</p>
1248</dd>
1249<dt>
Junio C Hamanob19b4f02006-10-29 20:47:221250<a href="git-fetch-pack.html">git-fetch-pack(1)</a>
1251</dt>
1252<dd>
1253<p>
Junio C Hamano7c73c662007-01-19 00:37:501254 Receive missing objects from another repository.
Junio C Hamanob19b4f02006-10-29 20:47:221255</p>
1256</dd>
1257<dt>
Junio C Hamano7c73c662007-01-19 00:37:501258<a href="git-local-fetch.html">git-local-fetch(1)</a>
1259</dt>
1260<dd>
1261<p>
1262 Duplicate another git repository on a local system.
1263</p>
1264</dd>
1265<dt>
Junio C Hamano7c73c662007-01-19 00:37:501266<a href="git-send-pack.html">git-send-pack(1)</a>
1267</dt>
1268<dd>
1269<p>
Junio C Hamanoee1e4282007-02-04 08:32:041270 Push objects over git protocol to another repository.
Junio C Hamanob19b4f02006-10-29 20:47:221271</p>
1272</dd>
1273<dt>
Junio C Hamanob19b4f02006-10-29 20:47:221274<a href="git-ssh-fetch.html">git-ssh-fetch(1)</a>
1275</dt>
1276<dd>
1277<p>
Junio C Hamano7c73c662007-01-19 00:37:501278 Fetch from a remote repository over ssh connection.
Junio C Hamanob19b4f02006-10-29 20:47:221279</p>
1280</dd>
1281<dt>
1282<a href="git-ssh-upload.html">git-ssh-upload(1)</a>
1283</dt>
1284<dd>
1285<p>
Junio C Hamano7c73c662007-01-19 00:37:501286 Push to a remote repository over ssh connection.
Junio C Hamanob19b4f02006-10-29 20:47:221287</p>
1288</dd>
1289<dt>
1290<a href="git-update-server-info.html">git-update-server-info(1)</a>
1291</dt>
1292<dd>
1293<p>
Junio C Hamano7c73c662007-01-19 00:37:501294 Update auxiliary info file to help dumb servers.
Junio C Hamanob19b4f02006-10-29 20:47:221295</p>
1296</dd>
Junio C Hamano4ad294b2007-01-20 02:22:501297</dl>
1298<p>The following are helper programs used by the above; end users
1299typically do not use them directly.</p>
1300<dl>
1301<dt>
1302<a href="git-http-fetch.html">git-http-fetch(1)</a>
1303</dt>
1304<dd>
1305<p>
1306 Download from a remote git repository via HTTP.
1307</p>
1308</dd>
1309<dt>
1310<a href="git-http-push.html">git-http-push(1)</a>
1311</dt>
1312<dd>
1313<p>
1314 Push objects over HTTP/DAV to another repository.
1315</p>
1316</dd>
1317<dt>
1318<a href="git-parse-remote.html">git-parse-remote(1)</a>
1319</dt>
1320<dd>
1321<p>
1322 Routines to help parsing remote repository access parameters.
1323</p>
1324</dd>
1325<dt>
1326<a href="git-receive-pack.html">git-receive-pack(1)</a>
1327</dt>
1328<dd>
1329<p>
1330 Receive what is pushed into the repository.
1331</p>
1332</dd>
1333<dt>
1334<a href="git-shell.html">git-shell(1)</a>
1335</dt>
1336<dd>
1337<p>
1338 Restricted login shell for GIT-only SSH access.
1339</p>
1340</dd>
Junio C Hamanob19b4f02006-10-29 20:47:221341<dt>
1342<a href="git-upload-archive.html">git-upload-archive(1)</a>
1343</dt>
1344<dd>
1345<p>
Junio C Hamano7c73c662007-01-19 00:37:501346 Send archive back to git-archive.
Junio C Hamanob19b4f02006-10-29 20:47:221347</p>
1348</dd>
1349<dt>
1350<a href="git-upload-pack.html">git-upload-pack(1)</a>
1351</dt>
1352<dd>
1353<p>
Junio C Hamano7c73c662007-01-19 00:37:501354 Send objects packed back to git-fetch-pack.
Junio C Hamanob19b4f02006-10-29 20:47:221355</p>
1356</dd>
1357</dl>
Junio C Hamano4ad294b2007-01-20 02:22:501358<h3>Internal helper commands</h3>
1359<p>These are internal helper commands used by other commands; end
1360users typically do not use them directly.</p>
1361<dl>
1362<dt>
1363<a href="git-applypatch.html">git-applypatch(1)</a>
1364</dt>
1365<dd>
1366<p>
1367 Apply one patch extracted from an e-mail.
1368</p>
1369</dd>
1370<dt>
Junio C Hamanoe90436a2007-04-22 07:22:131371<a href="git-check-attr.html">git-check-attr(1)</a>
1372</dt>
1373<dd>
1374<p>
1375 Display gitattributes information..
1376</p>
1377</dd>
1378<dt>
Junio C Hamano4ad294b2007-01-20 02:22:501379<a href="git-check-ref-format.html">git-check-ref-format(1)</a>
1380</dt>
1381<dd>
1382<p>
1383 Make sure ref name is well formed.
1384</p>
1385</dd>
1386<dt>
1387<a href="git-fmt-merge-msg.html">git-fmt-merge-msg(1)</a>
1388</dt>
1389<dd>
1390<p>
1391 Produce a merge commit message.
1392</p>
1393</dd>
1394<dt>
1395<a href="git-mailinfo.html">git-mailinfo(1)</a>
1396</dt>
1397<dd>
1398<p>
1399 Extracts patch and authorship from a single e-mail message.
1400</p>
1401</dd>
1402<dt>
1403<a href="git-mailsplit.html">git-mailsplit(1)</a>
1404</dt>
1405<dd>
1406<p>
1407 Simple UNIX mbox splitter program.
1408</p>
1409</dd>
1410<dt>
1411<a href="git-merge-one-file.html">git-merge-one-file(1)</a>
1412</dt>
1413<dd>
1414<p>
1415 The standard helper program to use with git-merge-index.
1416</p>
1417</dd>
1418<dt>
1419<a href="git-patch-id.html">git-patch-id(1)</a>
1420</dt>
1421<dd>
1422<p>
1423 Compute unique ID for a patch.
1424</p>
1425</dd>
1426<dt>
1427<a href="git-peek-remote.html">git-peek-remote(1)</a>
1428</dt>
1429<dd>
1430<p>
1431 List the references in a remote repository.
1432</p>
1433</dd>
1434<dt>
1435<a href="git-sh-setup.html">git-sh-setup(1)</a>
1436</dt>
1437<dd>
1438<p>
1439 Common git shell script setup code.
1440</p>
1441</dd>
1442<dt>
1443<a href="git-stripspace.html">git-stripspace(1)</a>
1444</dt>
1445<dd>
1446<p>
1447 Filter out empty lines.
1448</p>
1449</dd>
1450</dl>
Junio C Hamanob19b4f02006-10-29 20:47:221451</div>
Junio C Hamano1a4e8412005-12-27 08:17:231452<h2>Configuration Mechanism</h2>
1453<div class="sectionbody">
1454<p>Starting from 0.99.9 (actually mid 0.99.8.GIT), <tt>.git/config</tt> file
1455is used to hold per-repository configuration options. It is a
Junio C Hamano51c2ab02006-07-09 20:38:541456simple text file modeled after <tt>.ini</tt> format familiar to some
Junio C Hamano1a4e8412005-12-27 08:17:231457people. Here is an example:</p>
1458<div class="listingblock">
1459<div class="content">
1460<pre><tt>#
1461# A '#' or ';' character indicates a comment.
1462#
1463
1464; core variables
1465[core]
1466 ; Don't trust file modes
1467 filemode = false
1468
1469; user identity
1470[user]
1471 name = "Junio C Hamano"
1472 email = "junkio@twinsun.com"
1473</tt></pre>
1474</div></div>
1475<p>Various commands read from the configuration file and adjust
1476their operation accordingly.</p>
1477</div>
1478<h2>Identifier Terminology</h2>
1479<div class="sectionbody">
1480<dl>
1481<dt>
1482&lt;object&gt;
1483</dt>
1484<dd>
1485<p>
1486 Indicates the object name for any type of object.
1487</p>
1488</dd>
1489<dt>
1490&lt;blob&gt;
1491</dt>
1492<dd>
1493<p>
1494 Indicates a blob object name.
1495</p>
1496</dd>
1497<dt>
1498&lt;tree&gt;
1499</dt>
1500<dd>
1501<p>
1502 Indicates a tree object name.
1503</p>
1504</dd>
1505<dt>
1506&lt;commit&gt;
1507</dt>
1508<dd>
1509<p>
1510 Indicates a commit object name.
1511</p>
1512</dd>
1513<dt>
1514&lt;tree-ish&gt;
1515</dt>
1516<dd>
1517<p>
1518 Indicates a tree, commit or tag object name. A
1519 command that takes a &lt;tree-ish&gt; argument ultimately wants to
1520 operate on a &lt;tree&gt; object but automatically dereferences
1521 &lt;commit&gt; and &lt;tag&gt; objects that point at a &lt;tree&gt;.
1522</p>
1523</dd>
1524<dt>
Junio C Hamano60f8aa82007-03-06 09:58:261525&lt;commit-ish&gt;
1526</dt>
1527<dd>
1528<p>
1529 Indicates a commit or tag object name. A
1530 command that takes a &lt;commit-ish&gt; argument ultimately wants to
1531 operate on a &lt;commit&gt; object but automatically dereferences
1532 &lt;tag&gt; objects that point at a &lt;commit&gt;.
1533</p>
1534</dd>
1535<dt>
Junio C Hamano1a4e8412005-12-27 08:17:231536&lt;type&gt;
1537</dt>
1538<dd>
1539<p>
1540 Indicates that an object type is required.
1541 Currently one of: <tt>blob</tt>, <tt>tree</tt>, <tt>commit</tt>, or <tt>tag</tt>.
1542</p>
1543</dd>
1544<dt>
1545&lt;file&gt;
1546</dt>
1547<dd>
1548<p>
1549 Indicates a filename - almost always relative to the
1550 root of the tree structure <tt>GIT_INDEX_FILE</tt> describes.
1551</p>
1552</dd>
1553</dl>
1554</div>
1555<h2>Symbolic Identifiers</h2>
1556<div class="sectionbody">
1557<p>Any git command accepting any &lt;object&gt; can also use the following
1558symbolic notation:</p>
1559<dl>
1560<dt>
1561HEAD
1562</dt>
1563<dd>
1564<p>
1565 indicates the head of the current branch (i.e. the
1566 contents of <tt>$GIT_DIR/HEAD</tt>).
1567</p>
1568</dd>
1569<dt>
1570&lt;tag&gt;
1571</dt>
1572<dd>
1573<p>
1574 a valid tag <em>name</em>
1575 (i.e. the contents of <tt>$GIT_DIR/refs/tags/&lt;tag&gt;</tt>).
1576</p>
1577</dd>
1578<dt>
1579&lt;head&gt;
1580</dt>
1581<dd>
1582<p>
1583 a valid head <em>name</em>
1584 (i.e. the contents of <tt>$GIT_DIR/refs/heads/&lt;head&gt;</tt>).
1585</p>
1586</dd>
Junio C Hamano1a4e8412005-12-27 08:17:231587</dl>
Junio C Hamanoff4b4312006-10-25 22:55:311588<p>For a more complete list of ways to spell object names, see
1589"SPECIFYING REVISIONS" section in <a href="git-rev-parse.html">git-rev-parse(1)</a>.</p>
Junio C Hamano1a4e8412005-12-27 08:17:231590</div>
1591<h2>File/Directory Structure</h2>
1592<div class="sectionbody">
1593<p>Please see <a href="repository-layout.html">repository layout</a> document.</p>
Junio C Hamano818f7d62006-03-26 01:49:301594<p>Read <a href="hooks.html">hooks</a> for more details about each hook.</p>
Junio C Hamano1a4e8412005-12-27 08:17:231595<p>Higher level SCMs may provide and manage additional information in the
1596<tt>$GIT_DIR</tt>.</p>
1597</div>
1598<h2>Terminology</h2>
1599<div class="sectionbody">
1600<p>Please see <a href="glossary.html">glossary</a> document.</p>
1601</div>
1602<h2>Environment Variables</h2>
1603<div class="sectionbody">
1604<p>Various git commands use the following environment variables:</p>
1605<h3>The git Repository</h3>
1606<p>These environment variables apply to <em>all</em> core git commands. Nb: it
1607is worth noting that they may be used/overridden by SCMS sitting above
1608git so take care if using Cogito etc.</p>
1609<dl>
1610<dt>
1611<em>GIT_INDEX_FILE</em>
1612</dt>
1613<dd>
1614<p>
1615 This environment allows the specification of an alternate
1616 index file. If not specified, the default of <tt>$GIT_DIR/index</tt>
1617 is used.
1618</p>
1619</dd>
1620<dt>
1621<em>GIT_OBJECT_DIRECTORY</em>
1622</dt>
1623<dd>
1624<p>
1625 If the object storage directory is specified via this
1626 environment variable then the sha1 directories are created
1627 underneath - otherwise the default <tt>$GIT_DIR/objects</tt>
1628 directory is used.
1629</p>
1630</dd>
1631<dt>
1632<em>GIT_ALTERNATE_OBJECT_DIRECTORIES</em>
1633</dt>
1634<dd>
1635<p>
1636 Due to the immutable nature of git objects, old objects can be
1637 archived into shared, read-only directories. This variable
1638 specifies a ":" separated list of git object directories which
1639 can be used to search for git objects. New objects will not be
1640 written to these directories.
1641</p>
1642</dd>
1643<dt>
1644<em>GIT_DIR</em>
1645</dt>
1646<dd>
1647<p>
1648 If the <em>GIT_DIR</em> environment variable is set then it
1649 specifies a path to use instead of the default <tt>.git</tt>
1650 for the base of the repository.
1651</p>
1652</dd>
1653</dl>
1654<h3>git Commits</h3>
1655<dl>
1656<dt>
1657<em>GIT_AUTHOR_NAME</em>
1658</dt>
1659<dt>
1660<em>GIT_AUTHOR_EMAIL</em>
1661</dt>
1662<dt>
1663<em>GIT_AUTHOR_DATE</em>
1664</dt>
1665<dt>
1666<em>GIT_COMMITTER_NAME</em>
1667</dt>
1668<dt>
1669<em>GIT_COMMITTER_EMAIL</em>
1670</dt>
Junio C Hamano469d60e2007-04-29 18:30:341671<dt>
1672<em>GIT_COMMITTER_DATE</em>
1673</dt>
1674<dt>
1675<em>EMAIL</em>
1676</dt>
Junio C Hamano1a4e8412005-12-27 08:17:231677<dd>
1678<p>
1679 see <a href="git-commit-tree.html">git-commit-tree(1)</a>
1680</p>
1681</dd>
1682</dl>
1683<h3>git Diffs</h3>
1684<dl>
1685<dt>
1686<em>GIT_DIFF_OPTS</em>
1687</dt>
Junio C Hamano1c437122006-11-28 02:22:251688<dd>
1689<p>
1690 Only valid setting is "--unified=??" or "-u??" to set the
1691 number of context lines shown when a unified diff is created.
1692 This takes precedence over any "-U" or "--unified" option
1693 value passed on the git diff command line.
1694</p>
1695</dd>
Junio C Hamano1a4e8412005-12-27 08:17:231696<dt>
1697<em>GIT_EXTERNAL_DIFF</em>
1698</dt>
1699<dd>
1700<p>
Junio C Hamano1c437122006-11-28 02:22:251701 When the environment variable <em>GIT_EXTERNAL_DIFF</em> is set, the
1702 program named by it is called, instead of the diff invocation
1703 described above. For a path that is added, removed, or modified,
1704 <em>GIT_EXTERNAL_DIFF</em> is called with 7 parameters:
Junio C Hamano1a4e8412005-12-27 08:17:231705</p>
Junio C Hamano1c437122006-11-28 02:22:251706<div class="literalblock">
1707<div class="content">
1708<pre><tt>path old-file old-hex old-mode new-file new-hex new-mode</tt></pre>
1709</div></div>
1710<p>where:</p>
1711<div class="hlist"><table>
1712<tr>
1713<td class="hlist1">
1714&lt;old|new&gt;-file
1715</td>
1716<td class="hlist2">
1717are files GIT_EXTERNAL_DIFF can use to read the
1718 contents of &lt;old|new&gt;,
1719</td>
1720</tr>
1721<tr>
1722<td class="hlist1">
1723&lt;old|new&gt;-hex
1724</td>
1725<td class="hlist2">
1726are the 40-hexdigit SHA1 hashes,
1727</td>
1728</tr>
1729<tr>
1730<td class="hlist1">
1731&lt;old|new&gt;-mode
1732</td>
1733<td class="hlist2">
1734are the octal representation of the file modes.
1735</td>
1736</tr>
1737</table></div>
1738<p>The file parameters can point at the user's working file
1739(e.g. <tt>new-file</tt> in "git-diff-files"), <tt>/dev/null</tt> (e.g. <tt>old-file</tt>
1740when a new file is added), or a temporary file (e.g. <tt>old-file</tt> in the
1741index). <em>GIT_EXTERNAL_DIFF</em> should not worry about unlinking the
1742temporary file --- it is removed when <em>GIT_EXTERNAL_DIFF</em> exits.</p>
1743<p>For a path that is unmerged, <em>GIT_EXTERNAL_DIFF</em> is called with 1
1744parameter, &lt;path&gt;.</p>
Junio C Hamano1a4e8412005-12-27 08:17:231745</dd>
1746</dl>
Junio C Hamano7ccb9fd2006-07-15 01:38:401747<h3>other</h3>
1748<dl>
1749<dt>
Junio C Hamano85e45fa2006-08-13 07:47:411750<em>GIT_PAGER</em>
1751</dt>
1752<dd>
1753<p>
1754 This environment variable overrides <tt>$PAGER</tt>.
1755</p>
1756</dd>
1757<dt>
Junio C Hamano7ccb9fd2006-07-15 01:38:401758<em>GIT_TRACE</em>
1759</dt>
1760<dd>
1761<p>
Junio C Hamanoef4b48b2006-09-04 10:08:341762 If this variable is set to "1", "2" or "true" (comparison
1763 is case insensitive), git will print <tt>trace:</tt> messages on
Junio C Hamano7ccb9fd2006-07-15 01:38:401764 stderr telling about alias expansion, built-in command
1765 execution and external command execution.
Junio C Hamanoef4b48b2006-09-04 10:08:341766 If this variable is set to an integer value greater than 1
1767 and lower than 10 (strictly) then git will interpret this
1768 value as an open file descriptor and will try to write the
1769 trace messages into this file descriptor.
1770 Alternatively, if this variable is set to an absolute path
1771 (starting with a <em>/</em> character), git will interpret this
1772 as a file path and will try to write the trace messages
1773 into it.
Junio C Hamano7ccb9fd2006-07-15 01:38:401774</p>
1775</dd>
1776</dl>
Junio C Hamano1a4e8412005-12-27 08:17:231777</div>
1778<h2>Discussion<a id="Discussion"></a></h2>
1779<div class="sectionbody">
1780<p>"git" can mean anything, depending on your mood.</p>
1781<ul>
1782<li>
1783<p>
1784random three-letter combination that is pronounceable, and not
1785 actually used by any common UNIX command. The fact that it is a
1786 mispronunciation of "get" may or may not be relevant.
1787</p>
1788</li>
1789<li>
1790<p>
1791stupid. contemptible and despicable. simple. Take your pick from the
1792 dictionary of slang.
1793</p>
1794</li>
1795<li>
1796<p>
1797"global information tracker": you're in a good mood, and it actually
1798 works for you. Angels sing, and a light suddenly fills the room.
1799</p>
1800</li>
1801<li>
1802<p>
1803"goddamn idiotic truckload of sh*t": when it breaks
1804</p>
1805</li>
1806</ul>
Junio C Hamano4f9a6052007-01-17 20:25:161807<p>This is a (not so) stupid but extremely fast directory content manager.
1808It doesn't do a whole lot at its core, but what it <em>does</em> do is track
1809directory contents efficiently.</p>
Junio C Hamano1a4e8412005-12-27 08:17:231810<p>There are two object abstractions: the "object database", and the
1811"current directory cache" aka "index".</p>
1812<h3>The Object Database</h3>
1813<p>The object database is literally just a content-addressable collection
1814of objects. All objects are named by their content, which is
1815approximated by the SHA1 hash of the object itself. Objects may refer
1816to other objects (by referencing their SHA1 hash), and so you can
1817build up a hierarchy of objects.</p>
1818<p>All objects have a statically determined "type" aka "tag", which is
1819determined at object creation time, and which identifies the format of
1820the object (i.e. how it is used, and how it can refer to other
1821objects). There are currently four different object types: "blob",
1822"tree", "commit" and "tag".</p>
1823<p>A "blob" object cannot refer to any other object, and is, like the type
1824implies, a pure storage object containing some user data. It is used to
1825actually store the file data, i.e. a blob object is associated with some
1826particular version of some file.</p>
1827<p>A "tree" object is an object that ties one or more "blob" objects into a
1828directory structure. In addition, a tree object can refer to other tree
1829objects, thus creating a directory hierarchy.</p>
1830<p>A "commit" object ties such directory hierarchies together into
1831a DAG of revisions - each "commit" is associated with exactly one tree
1832(the directory hierarchy at the time of the commit). In addition, a
1833"commit" refers to one or more "parent" commit objects that describe the
1834history of how we arrived at that directory hierarchy.</p>
1835<p>As a special case, a commit object with no parents is called the "root"
1836object, and is the point of an initial project commit. Each project
1837must have at least one root, and while you can tie several different
1838root objects together into one project by creating a commit object which
1839has two or more separate roots as its ultimate parents, that's probably
1840just going to confuse people. So aim for the notion of "one root object
1841per project", even if git itself does not enforce that.</p>
1842<p>A "tag" object symbolically identifies and can be used to sign other
1843objects. It contains the identifier and type of another object, a
1844symbolic name (of course!) and, optionally, a signature.</p>
1845<p>Regardless of object type, all objects share the following
1846characteristics: they are all deflated with zlib, and have a header
1847that not only specifies their type, but also provides size information
1848about the data in the object. It's worth noting that the SHA1 hash
1849that is used to name the object is the hash of the original data
1850plus this header, so <tt>sha1sum</tt> <em>file</em> does not match the object name
1851for <em>file</em>.
1852(Historical note: in the dawn of the age of git the hash
1853was the sha1 of the <em>compressed</em> object.)</p>
1854<p>As a result, the general consistency of an object can always be tested
1855independently of the contents or the type of the object: all objects can
1856be validated by verifying that (a) their hashes match the content of the
1857file and (b) the object successfully inflates to a stream of bytes that
1858forms a sequence of &lt;ascii type without space&gt; + &lt;space&gt; + &lt;ascii decimal
1859size&gt; + &lt;byte\0&gt; + &lt;binary object data&gt;.</p>
1860<p>The structured objects can further have their structure and
1861connectivity to other objects verified. This is generally done with
Junio C Hamano7ad22dc2007-01-29 02:55:481862the <tt>git-fsck</tt> program, which generates a full dependency graph
Junio C Hamano1a4e8412005-12-27 08:17:231863of all objects, and verifies their internal consistency (in addition
1864to just verifying their superficial consistency through the hash).</p>
1865<p>The object types in some more detail:</p>
1866<h3>Blob Object</h3>
1867<p>A "blob" object is nothing but a binary blob of data, and doesn't
1868refer to anything else. There is no signature or any other
1869verification of the data, so while the object is consistent (it <em>is</em>
1870indexed by its sha1 hash, so the data itself is certainly correct), it
1871has absolutely no other attributes. No name associations, no
1872permissions. It is purely a blob of data (i.e. normally "file
1873contents").</p>
1874<p>In particular, since the blob is entirely defined by its data, if two
1875files in a directory tree (or in multiple different versions of the
1876repository) have the same contents, they will share the same blob
1877object. The object is totally independent of its location in the
1878directory tree, and renaming a file does not change the object that
1879file is associated with in any way.</p>
1880<p>A blob is typically created when <a href="git-update-index.html">git-update-index(1)</a>
Junio C Hamano89d4e0f2007-02-18 00:34:591881(or <a href="git-add.html">git-add(1)</a>) is run, and its data can be accessed by
1882<a href="git-cat-file.html">git-cat-file(1)</a>.</p>
Junio C Hamano1a4e8412005-12-27 08:17:231883<h3>Tree Object</h3>
1884<p>The next hierarchical object type is the "tree" object. A tree object
1885is a list of mode/name/blob data, sorted by name. Alternatively, the
1886mode data may specify a directory mode, in which case instead of
1887naming a blob, that name is associated with another TREE object.</p>
1888<p>Like the "blob" object, a tree object is uniquely determined by the
1889set contents, and so two separate but identical trees will always
1890share the exact same object. This is true at all levels, i.e. it's
1891true for a "leaf" tree (which does not refer to any other trees, only
1892blobs) as well as for a whole subdirectory.</p>
1893<p>For that reason a "tree" object is just a pure data abstraction: it
1894has no history, no signatures, no verification of validity, except
1895that since the contents are again protected by the hash itself, we can
1896trust that the tree is immutable and its contents never change.</p>
1897<p>So you can trust the contents of a tree to be valid, the same way you
1898can trust the contents of a blob, but you don't know where those
1899contents <em>came</em> from.</p>
1900<p>Side note on trees: since a "tree" object is a sorted list of
1901"filename+content", you can create a diff between two trees without
1902actually having to unpack two trees. Just ignore all common parts,
1903and your diff will look right. In other words, you can effectively
1904(and efficiently) tell the difference between any two random trees by
1905O(n) where "n" is the size of the difference, rather than the size of
1906the tree.</p>
1907<p>Side note 2 on trees: since the name of a "blob" depends entirely and
1908exclusively on its contents (i.e. there are no names or permissions
1909involved), you can see trivial renames or permission changes by
1910noticing that the blob stayed the same. However, renames with data
1911changes need a smarter "diff" implementation.</p>
1912<p>A tree is created with <a href="git-write-tree.html">git-write-tree(1)</a> and
1913its data can be accessed by <a href="git-ls-tree.html">git-ls-tree(1)</a>.
1914Two trees can be compared with <a href="git-diff-tree.html">git-diff-tree(1)</a>.</p>
1915<h3>Commit Object</h3>
1916<p>The "commit" object is an object that introduces the notion of
1917history into the picture. In contrast to the other objects, it
1918doesn't just describe the physical state of a tree, it describes how
1919we got there, and why.</p>
1920<p>A "commit" is defined by the tree-object that it results in, the
1921parent commits (zero, one or more) that led up to that point, and a
1922comment on what happened. Again, a commit is not trusted per se:
1923the contents are well-defined and "safe" due to the cryptographically
1924strong signatures at all levels, but there is no reason to believe
1925that the tree is "good" or that the merge information makes sense.
1926The parents do not have to actually have any relationship with the
1927result, for example.</p>
1928<p>Note on commits: unlike real SCM's, commits do not contain
1929rename information or file mode change information. All of that is
1930implicit in the trees involved (the result tree, and the result trees
1931of the parents), and describing that makes no sense in this idiotic
1932file manager.</p>
1933<p>A commit is created with <a href="git-commit-tree.html">git-commit-tree(1)</a> and
1934its data can be accessed by <a href="git-cat-file.html">git-cat-file(1)</a>.</p>
1935<h3>Trust</h3>
1936<p>An aside on the notion of "trust". Trust is really outside the scope
1937of "git", but it's worth noting a few things. First off, since
1938everything is hashed with SHA1, you <em>can</em> trust that an object is
1939intact and has not been messed with by external sources. So the name
1940of an object uniquely identifies a known state - just not a state that
1941you may want to trust.</p>
1942<p>Furthermore, since the SHA1 signature of a commit refers to the
1943SHA1 signatures of the tree it is associated with and the signatures
1944of the parent, a single named commit specifies uniquely a whole set
1945of history, with full contents. You can't later fake any step of the
1946way once you have the name of a commit.</p>
1947<p>So to introduce some real trust in the system, the only thing you need
1948to do is to digitally sign just <em>one</em> special note, which includes the
1949name of a top-level commit. Your digital signature shows others
1950that you trust that commit, and the immutability of the history of
1951commits tells others that they can trust the whole history.</p>
1952<p>In other words, you can easily validate a whole archive by just
1953sending out a single email that tells the people the name (SHA1 hash)
1954of the top commit, and digitally sign that email using something
1955like GPG/PGP.</p>
1956<p>To assist in this, git also provides the tag object&#8230;</p>
1957<h3>Tag Object</h3>
1958<p>Git provides the "tag" object to simplify creating, managing and
1959exchanging symbolic and signed tokens. The "tag" object at its
1960simplest simply symbolically identifies another object by containing
1961the sha1, type and symbolic name.</p>
1962<p>However it can optionally contain additional signature information
1963(which git doesn't care about as long as there's less than 8k of
1964it). This can then be verified externally to git.</p>
1965<p>Note that despite the tag features, "git" itself only handles content
1966integrity; the trust framework (and signature provision and
1967verification) has to come from outside.</p>
1968<p>A tag is created with <a href="git-mktag.html">git-mktag(1)</a>,
1969its data can be accessed by <a href="git-cat-file.html">git-cat-file(1)</a>,
1970and the signature can be verified by
1971<a href="git-verify-tag.html">git-verify-tag(1)</a>.</p>
1972</div>
1973<h2>The "index" aka "Current Directory Cache"</h2>
1974<div class="sectionbody">
1975<p>The index is a simple binary file, which contains an efficient
1976representation of a virtual directory content at some random time. It
1977does so by a simple array that associates a set of names, dates,
1978permissions and content (aka "blob") objects together. The cache is
1979always kept ordered by name, and names are unique (with a few very
1980specific rules) at any point in time, but the cache has no long-term
1981meaning, and can be partially updated at any time.</p>
1982<p>In particular, the index certainly does not need to be consistent with
1983the current directory contents (in fact, most operations will depend on
1984different ways to make the index <em>not</em> be consistent with the directory
1985hierarchy), but it has three very important attributes:</p>
1986<p><em>(a) it can re-generate the full state it caches (not just the
1987directory structure: it contains pointers to the "blob" objects so
1988that it can regenerate the data too)</em></p>
1989<p>As a special case, there is a clear and unambiguous one-way mapping
1990from a current directory cache to a "tree object", which can be
1991efficiently created from just the current directory cache without
1992actually looking at any other data. So a directory cache at any one
1993time uniquely specifies one and only one "tree" object (but has
1994additional data to make it easy to match up that tree object with what
1995has happened in the directory)</p>
1996<p><em>(b) it has efficient methods for finding inconsistencies between that
1997cached state ("tree object waiting to be instantiated") and the
1998current state.</em></p>
1999<p><em>(c) it can additionally efficiently represent information about merge
2000conflicts between different tree objects, allowing each pathname to be
2001associated with sufficient information about the trees involved that
2002you can create a three-way merge between them.</em></p>
2003<p>Those are the three ONLY things that the directory cache does. It's a
2004cache, and the normal operation is to re-generate it completely from a
2005known tree object, or update/compare it with a live tree that is being
2006developed. If you blow the directory cache away entirely, you generally
2007haven't lost any information as long as you have the name of the tree
2008that it described.</p>
2009<p>At the same time, the index is at the same time also the
2010staging area for creating new trees, and creating a new tree always
2011involves a controlled modification of the index file. In particular,
2012the index file can have the representation of an intermediate tree that
2013has not yet been instantiated. So the index can be thought of as a
2014write-back cache, which can contain dirty information that has not yet
2015been written back to the backing store.</p>
2016</div>
2017<h2>The Workflow</h2>
2018<div class="sectionbody">
2019<p>Generally, all "git" operations work on the index file. Some operations
2020work <strong>purely</strong> on the index file (showing the current state of the
2021index), but most operations move data to and from the index file. Either
2022from the database or from the working directory. Thus there are four
2023main combinations:</p>
2024<h3>1) working directory -&gt; index</h3>
2025<p>You update the index with information from the working directory with
2026the <a href="git-update-index.html">git-update-index(1)</a> command. You
2027generally update the index information by just specifying the filename
2028you want to update, like so:</p>
2029<div class="literalblock">
2030<div class="content">
2031<pre><tt>git-update-index filename</tt></pre>
2032</div></div>
2033<p>but to avoid common mistakes with filename globbing etc, the command
2034will not normally add totally new entries or remove old entries,
2035i.e. it will normally just update existing cache entries.</p>
2036<p>To tell git that yes, you really do realize that certain files no
2037longer exist, or that new files should be added, you
2038should use the <tt>--remove</tt> and <tt>--add</tt> flags respectively.</p>
2039<p>NOTE! A <tt>--remove</tt> flag does <em>not</em> mean that subsequent filenames will
2040necessarily be removed: if the files still exist in your directory
2041structure, the index will be updated with their new status, not
2042removed. The only thing <tt>--remove</tt> means is that update-cache will be
2043considering a removed file to be a valid thing, and if the file really
2044does not exist any more, it will update the index accordingly.</p>
2045<p>As a special case, you can also do <tt>git-update-index --refresh</tt>, which
2046will refresh the "stat" information of each index to match the current
2047stat information. It will <em>not</em> update the object status itself, and
2048it will only update the fields that are used to quickly test whether
2049an object still matches its old backing store object.</p>
2050<h3>2) index -&gt; object database</h3>
2051<p>You write your current index file to a "tree" object with the program</p>
2052<div class="literalblock">
2053<div class="content">
2054<pre><tt>git-write-tree</tt></pre>
2055</div></div>
2056<p>that doesn't come with any options - it will just write out the
2057current index into the set of tree objects that describe that state,
2058and it will return the name of the resulting top-level tree. You can
2059use that tree to re-generate the index at any time by going in the
2060other direction:</p>
2061<h3>3) object database -&gt; index</h3>
2062<p>You read a "tree" file from the object database, and use that to
2063populate (and overwrite - don't do this if your index contains any
2064unsaved state that you might want to restore later!) your current
2065index. Normal operation is just</p>
2066<div class="literalblock">
2067<div class="content">
2068<pre><tt>git-read-tree &lt;sha1 of tree&gt;</tt></pre>
2069</div></div>
2070<p>and your index file will now be equivalent to the tree that you saved
2071earlier. However, that is only your <em>index</em> file: your working
2072directory contents have not been modified.</p>
2073<h3>4) index -&gt; working directory</h3>
2074<p>You update your working directory from the index by "checking out"
2075files. This is not a very common operation, since normally you'd just
2076keep your files updated, and rather than write to your working
2077directory, you'd tell the index files about the changes in your
2078working directory (i.e. <tt>git-update-index</tt>).</p>
2079<p>However, if you decide to jump to a new version, or check out somebody
2080else's version, or just restore a previous tree, you'd populate your
2081index file with read-tree, and then you need to check out the result
2082with</p>
2083<div class="literalblock">
2084<div class="content">
2085<pre><tt>git-checkout-index filename</tt></pre>
2086</div></div>
2087<p>or, if you want to check out all of the index, use <tt>-a</tt>.</p>
2088<p>NOTE! git-checkout-index normally refuses to overwrite old files, so
2089if you have an old version of the tree already checked out, you will
2090need to use the "-f" flag (<em>before</em> the "-a" flag or the filename) to
2091<em>force</em> the checkout.</p>
2092<p>Finally, there are a few odds and ends which are not purely moving
2093from one representation to the other:</p>
2094<h3>5) Tying it all together</h3>
2095<p>To commit a tree you have instantiated with "git-write-tree", you'd
2096create a "commit" object that refers to that tree and the history
2097behind it - most notably the "parent" commits that preceded it in
2098history.</p>
2099<p>Normally a "commit" has one parent: the previous state of the tree
2100before a certain change was made. However, sometimes it can have two
2101or more parent commits, in which case we call it a "merge", due to the
2102fact that such a commit brings together ("merges") two or more
2103previous states represented by other commits.</p>
2104<p>In other words, while a "tree" represents a particular directory state
2105of a working directory, a "commit" represents that state in "time",
2106and explains how we got there.</p>
2107<p>You create a commit object by giving it the tree that describes the
2108state at the time of the commit, and a list of parents:</p>
2109<div class="literalblock">
2110<div class="content">
2111<pre><tt>git-commit-tree &lt;tree&gt; -p &lt;parent&gt; [-p &lt;parent2&gt; ..]</tt></pre>
2112</div></div>
2113<p>and then giving the reason for the commit on stdin (either through
2114redirection from a pipe or file, or by just typing it at the tty).</p>
2115<p>git-commit-tree will return the name of the object that represents
2116that commit, and you should save it away for later use. Normally,
2117you'd commit a new <tt>HEAD</tt> state, and while git doesn't care where you
2118save the note about that state, in practice we tend to just write the
2119result to the file pointed at by <tt>.git/HEAD</tt>, so that we can always see
2120what the last committed state was.</p>
2121<p>Here is an ASCII art by Jon Loeliger that illustrates how
2122various pieces fit together.</p>
2123<div class="listingblock">
2124<div class="content">
2125<pre><tt>
2126 commit-tree
2127 commit obj
2128 +----+
2129 | |
2130 | |
2131 V V
2132 +-----------+
2133 | Object DB |
2134 | Backing |
2135 | Store |
2136 +-----------+
2137 ^
2138 write-tree | |
2139 tree obj | |
2140 | | read-tree
2141 | | tree obj
2142 V
2143 +-----------+
2144 | Index |
2145 | "cache" |
2146 +-----------+
2147 update-index ^
2148 blob obj | |
2149 | |
2150 checkout-index -u | | checkout-index
2151 stat | | blob obj
2152 V
2153 +-----------+
2154 | Working |
2155 | Directory |
2156 +-----------+
2157</tt></pre>
2158</div></div>
2159<h3>6) Examining the data</h3>
2160<p>You can examine the data represented in the object database and the
2161index with various helper tools. For every object, you can use
2162<a href="git-cat-file.html">git-cat-file(1)</a> to examine details about the
2163object:</p>
2164<div class="literalblock">
2165<div class="content">
2166<pre><tt>git-cat-file -t &lt;objectname&gt;</tt></pre>
2167</div></div>
2168<p>shows the type of the object, and once you have the type (which is
2169usually implicit in where you find the object), you can use</p>
2170<div class="literalblock">
2171<div class="content">
2172<pre><tt>git-cat-file blob|tree|commit|tag &lt;objectname&gt;</tt></pre>
2173</div></div>
2174<p>to show its contents. NOTE! Trees have binary content, and as a result
2175there is a special helper for showing that content, called
2176<tt>git-ls-tree</tt>, which turns the binary content into a more easily
2177readable form.</p>
2178<p>It's especially instructive to look at "commit" objects, since those
2179tend to be small and fairly self-explanatory. In particular, if you
2180follow the convention of having the top commit name in <tt>.git/HEAD</tt>,
2181you can do</p>
2182<div class="literalblock">
2183<div class="content">
2184<pre><tt>git-cat-file commit HEAD</tt></pre>
2185</div></div>
2186<p>to see what the top commit was.</p>
2187<h3>7) Merging multiple trees</h3>
2188<p>Git helps you do a three-way merge, which you can expand to n-way by
2189repeating the merge procedure arbitrary times until you finally
2190"commit" the state. The normal situation is that you'd only do one
2191three-way merge (two parents), and commit it, but if you like to, you
2192can do multiple parents in one go.</p>
2193<p>To do a three-way merge, you need the two sets of "commit" objects
2194that you want to merge, use those to find the closest common parent (a
2195third "commit" object), and then use those commit objects to find the
2196state of the directory ("tree" object) at these points.</p>
2197<p>To get the "base" for the merge, you first look up the common parent
2198of two commits with</p>
2199<div class="literalblock">
2200<div class="content">
2201<pre><tt>git-merge-base &lt;commit1&gt; &lt;commit2&gt;</tt></pre>
2202</div></div>
2203<p>which will return you the commit they are both based on. You should
2204now look up the "tree" objects of those commits, which you can easily
2205do with (for example)</p>
2206<div class="literalblock">
2207<div class="content">
2208<pre><tt>git-cat-file commit &lt;commitname&gt; | head -1</tt></pre>
2209</div></div>
2210<p>since the tree object information is always the first line in a commit
2211object.</p>
2212<p>Once you know the three trees you are going to merge (the one
2213"original" tree, aka the common case, and the two "result" trees, aka
2214the branches you want to merge), you do a "merge" read into the
2215index. This will complain if it has to throw away your old index contents, so you should
2216make sure that you've committed those - in fact you would normally
2217always do a merge against your last commit (which should thus match
2218what you have in your current index anyway).</p>
2219<p>To do the merge, do</p>
2220<div class="literalblock">
2221<div class="content">
2222<pre><tt>git-read-tree -m -u &lt;origtree&gt; &lt;yourtree&gt; &lt;targettree&gt;</tt></pre>
2223</div></div>
2224<p>which will do all trivial merge operations for you directly in the
2225index file, and you can just write the result out with
2226<tt>git-write-tree</tt>.</p>
2227<p>Historical note. We did not have <tt>-u</tt> facility when this
2228section was first written, so we used to warn that
2229the merge is done in the index file, not in your
2230working tree, and your working tree will not match your
2231index after this step.
2232This is no longer true. The above command, thanks to <tt>-u</tt>
2233option, updates your working tree with the merge results for
2234paths that have been trivially merged.</p>
2235<h3>8) Merging multiple trees, continued</h3>
2236<p>Sadly, many merges aren't trivial. If there are files that have
2237been added.moved or removed, or if both branches have modified the
2238same file, you will be left with an index tree that contains "merge
2239entries" in it. Such an index tree can <em>NOT</em> be written out to a tree
2240object, and you will have to resolve any such merge clashes using
2241other tools before you can write out the result.</p>
2242<p>You can examine such index state with <tt>git-ls-files --unmerged</tt>
2243command. An example:</p>
2244<div class="listingblock">
2245<div class="content">
2246<pre><tt>$ git-read-tree -m $orig HEAD $target
2247$ git-ls-files --unmerged
2248100644 263414f423d0e4d70dae8fe53fa34614ff3e2860 1 hello.c
2249100644 06fa6a24256dc7e560efa5687fa84b51f0263c3a 2 hello.c
2250100644 cc44c73eb783565da5831b4d820c962954019b69 3 hello.c</tt></pre>
2251</div></div>
2252<p>Each line of the <tt>git-ls-files --unmerged</tt> output begins with
2253the blob mode bits, blob SHA1, <em>stage number</em>, and the
2254filename. The <em>stage number</em> is git's way to say which tree it
2255came from: stage 1 corresponds to <tt>$orig</tt> tree, stage 2 <tt>HEAD</tt>
2256tree, and stage3 <tt>$target</tt> tree.</p>
2257<p>Earlier we said that trivial merges are done inside
2258<tt>git-read-tree -m</tt>. For example, if the file did not change
2259from <tt>$orig</tt> to <tt>HEAD</tt> nor <tt>$target</tt>, or if the file changed
2260from <tt>$orig</tt> to <tt>HEAD</tt> and <tt>$orig</tt> to <tt>$target</tt> the same way,
2261obviously the final outcome is what is in <tt>HEAD</tt>. What the
2262above example shows is that file <tt>hello.c</tt> was changed from
2263<tt>$orig</tt> to <tt>HEAD</tt> and <tt>$orig</tt> to <tt>$target</tt> in a different way.
2264You could resolve this by running your favorite 3-way merge
2265program, e.g. <tt>diff3</tt> or <tt>merge</tt>, on the blob objects from
2266these three stages yourself, like this:</p>
2267<div class="listingblock">
2268<div class="content">
2269<pre><tt>$ git-cat-file blob 263414f... &gt;hello.c~1
2270$ git-cat-file blob 06fa6a2... &gt;hello.c~2
2271$ git-cat-file blob cc44c73... &gt;hello.c~3
2272$ merge hello.c~2 hello.c~1 hello.c~3</tt></pre>
2273</div></div>
2274<p>This would leave the merge result in <tt>hello.c~2</tt> file, along
2275with conflict markers if there are conflicts. After verifying
2276the merge result makes sense, you can tell git what the final
2277merge result for this file is by:</p>
2278<div class="literalblock">
2279<div class="content">
2280<pre><tt>mv -f hello.c~2 hello.c
2281git-update-index hello.c</tt></pre>
2282</div></div>
2283<p>When a path is in unmerged state, running <tt>git-update-index</tt> for
2284that path tells git to mark the path resolved.</p>
2285<p>The above is the description of a git merge at the lowest level,
2286to help you understand what conceptually happens under the hood.
2287In practice, nobody, not even git itself, uses three <tt>git-cat-file</tt>
2288for this. There is <tt>git-merge-index</tt> program that extracts the
2289stages to temporary files and calls a "merge" script on it:</p>
2290<div class="literalblock">
2291<div class="content">
2292<pre><tt>git-merge-index git-merge-one-file hello.c</tt></pre>
2293</div></div>
Junio C Hamano053827f2007-02-14 07:23:582294<p>and that is what higher level <tt>git merge -s resolve</tt> is implemented
2295with.</p>
Junio C Hamano1a4e8412005-12-27 08:17:232296</div>
2297<h2>Authors</h2>
2298<div class="sectionbody">
2299<ul>
2300<li>
2301<p>
2302git's founding father is Linus Torvalds &lt;torvalds@osdl.org&gt;.
2303</p>
2304</li>
2305<li>
2306<p>
2307The current git nurse is Junio C Hamano &lt;junkio@cox.net&gt;.
2308</p>
2309</li>
2310<li>
2311<p>
2312The git potty was written by Andres Ericsson &lt;ae@op5.se&gt;.
2313</p>
2314</li>
2315<li>
2316<p>
2317General upbringing is handled by the git-list &lt;git@vger.kernel.org&gt;.
2318</p>
2319</li>
2320</ul>
2321</div>
2322<h2>Documentation</h2>
2323<div class="sectionbody">
2324<p>The documentation for git suite was started by David Greaves
2325&lt;david@dgreaves.com&gt;, and later enhanced greatly by the
2326contributors on the git-list &lt;git@vger.kernel.org&gt;.</p>
2327</div>
2328<h2>GIT</h2>
2329<div class="sectionbody">
2330<p>Part of the <a href="git.html">git(7)</a> suite</p>
2331</div>
2332<div id="footer">
2333<div id="footer-text">
Junio C Hamano469d60e2007-04-29 18:30:342334Last updated 29-Apr-2007 18:29:52 UTC
Junio C Hamano1a4e8412005-12-27 08:17:232335</div>
2336</div>
2337</body>
2338</html>