Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | <!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 Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 6 | <meta name="generator" content="AsciiDoc 7.0.2" /> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | <style type="text/css"> |
| 8 | /* Debug borders */ |
| 9 | p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 { |
| 10 | /* |
| 11 | border: 1px solid red; |
| 12 | */ |
| 13 | } |
| 14 | |
| 15 | body { |
| 16 | margin: 1em 5% 1em 5%; |
| 17 | } |
| 18 | |
| 19 | a { color: blue; } |
| 20 | a:visited { color: fuchsia; } |
| 21 | |
| 22 | em { |
| 23 | font-style: italic; |
| 24 | } |
| 25 | |
| 26 | strong { |
| 27 | font-weight: bold; |
| 28 | } |
| 29 | |
| 30 | tt { |
| 31 | color: navy; |
| 32 | } |
| 33 | |
| 34 | h1, 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 | |
| 42 | h1 { |
| 43 | border-bottom: 2px solid silver; |
| 44 | } |
| 45 | h2 { |
| 46 | border-bottom: 2px solid silver; |
| 47 | padding-top: 0.5em; |
| 48 | } |
| 49 | |
| 50 | div.sectionbody { |
| 51 | font-family: serif; |
| 52 | margin-left: 0; |
| 53 | } |
| 54 | |
| 55 | hr { |
| 56 | border: 1px solid silver; |
| 57 | } |
| 58 | |
| 59 | p { |
| 60 | margin-top: 0.5em; |
| 61 | margin-bottom: 0.5em; |
| 62 | } |
| 63 | |
| 64 | pre { |
| 65 | padding: 0; |
| 66 | margin: 0; |
| 67 | } |
| 68 | |
| 69 | span#author { |
| 70 | color: #527bbd; |
| 71 | font-family: sans-serif; |
| 72 | font-weight: bold; |
| 73 | font-size: 1.2em; |
| 74 | } |
| 75 | span#email { |
| 76 | } |
| 77 | span#revision { |
| 78 | font-family: sans-serif; |
| 79 | } |
| 80 | |
| 81 | div#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 | } |
| 88 | div#footer-text { |
| 89 | float: left; |
| 90 | padding-bottom: 0.5em; |
| 91 | } |
| 92 | div#footer-badges { |
| 93 | float: right; |
| 94 | padding-bottom: 0.5em; |
| 95 | } |
| 96 | |
| 97 | div#preamble, |
| 98 | div.tableblock, div.imageblock, div.exampleblock, div.verseblock, |
| 99 | div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, |
| 100 | div.admonitionblock { |
| 101 | margin-right: 10%; |
| 102 | margin-top: 1.5em; |
| 103 | margin-bottom: 1.5em; |
| 104 | } |
| 105 | div.admonitionblock { |
| 106 | margin-top: 2.5em; |
| 107 | margin-bottom: 2.5em; |
| 108 | } |
| 109 | |
| 110 | div.content { /* Block element content. */ |
| 111 | padding: 0; |
| 112 | } |
| 113 | |
| 114 | /* Block element titles. */ |
| 115 | div.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 | } |
| 122 | div.title + * { |
| 123 | margin-top: 0; |
| 124 | } |
| 125 | |
| 126 | td div.title:first-child { |
| 127 | margin-top: 0.0em; |
| 128 | } |
| 129 | div.content div.title:first-child { |
| 130 | margin-top: 0.0em; |
| 131 | } |
| 132 | div.content + div.title { |
| 133 | margin-top: 0.0em; |
| 134 | } |
| 135 | |
| 136 | div.sidebarblock > div.content { |
| 137 | background: #ffffee; |
| 138 | border: 1px solid silver; |
| 139 | padding: 0.5em; |
| 140 | } |
| 141 | |
| 142 | div.listingblock > div.content { |
| 143 | border: 1px solid silver; |
| 144 | background: #f4f4f4; |
| 145 | padding: 0.5em; |
| 146 | } |
| 147 | |
| 148 | div.quoteblock > div.content { |
| 149 | padding-left: 2.0em; |
| 150 | } |
| 151 | div.quoteblock .attribution { |
| 152 | text-align: right; |
| 153 | } |
| 154 | |
| 155 | div.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 | } |
| 163 | div.admonitionblock td.content { |
| 164 | padding-left: 0.5em; |
| 165 | border-left: 2px solid silver; |
| 166 | } |
| 167 | |
| 168 | div.exampleblock > div.content { |
| 169 | border-left: 2px solid silver; |
| 170 | padding: 0.5em; |
| 171 | } |
| 172 | |
| 173 | div.verseblock div.content { |
| 174 | white-space: pre; |
| 175 | } |
| 176 | |
| 177 | div.imageblock div.content { padding-left: 0; } |
| 178 | div.imageblock img { border: 1px solid silver; } |
| 179 | span.image img { border-style: none; } |
| 180 | |
| 181 | dl { |
| 182 | margin-top: 0.8em; |
| 183 | margin-bottom: 0.8em; |
| 184 | } |
| 185 | dt { |
| 186 | margin-top: 0.5em; |
| 187 | margin-bottom: 0; |
| 188 | font-style: italic; |
| 189 | } |
| 190 | dd > *:first-child { |
| 191 | margin-top: 0; |
| 192 | } |
| 193 | |
| 194 | ul, ol { |
| 195 | list-style-position: outside; |
| 196 | } |
| 197 | ol.olist2 { |
| 198 | list-style-type: lower-alpha; |
| 199 | } |
| 200 | |
| 201 | div.tableblock > table { |
| 202 | border-color: #527bbd; |
| 203 | border-width: 3px; |
| 204 | } |
| 205 | thead { |
| 206 | font-family: sans-serif; |
| 207 | font-weight: bold; |
| 208 | } |
| 209 | tfoot { |
| 210 | font-weight: bold; |
| 211 | } |
| 212 | |
| 213 | div.hlist { |
| 214 | margin-top: 0.8em; |
| 215 | margin-bottom: 0.8em; |
| 216 | } |
| 217 | td.hlist1 { |
| 218 | vertical-align: top; |
| 219 | font-style: italic; |
| 220 | padding-right: 0.8em; |
| 221 | } |
| 222 | td.hlist2 { |
| 223 | vertical-align: top; |
| 224 | } |
| 225 | |
| 226 | @media print { |
| 227 | div#footer-badges { display: none; } |
| 228 | } |
| 229 | include::./stylesheets/xhtml11-manpage.css[] |
| 230 | /* Workarounds for IE6's broken and incomplete CSS2. */ |
| 231 | |
| 232 | div.sidebar-content { |
| 233 | background: #ffffee; |
| 234 | border: 1px solid silver; |
| 235 | padding: 0.5em; |
| 236 | } |
| 237 | div.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 | |
| 244 | div.listingblock div.content { |
| 245 | border: 1px solid silver; |
| 246 | background: #f4f4f4; |
| 247 | padding: 0.5em; |
| 248 | } |
| 249 | |
| 250 | div.quoteblock-content { |
| 251 | padding-left: 2.0em; |
| 252 | } |
| 253 | |
| 254 | div.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> |
| 264 | git(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 Hamano | 6b2cee1 | 2006-08-26 08:43:31 | [diff] [blame] | 275 | <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 Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 278 | </div> |
| 279 | <h2>DESCRIPTION</h2> |
| 280 | <div class="sectionbody"> |
Junio C Hamano | e27fb93 | 2006-04-03 05:34:10 | [diff] [blame] | 281 | <p>Git is a fast, scalable, distributed revision control system with an |
| 282 | unusually rich command set that provides both high-level operations |
| 283 | and 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 |
| 287 | also want to read <a href="cvs-migration.html">CVS migration</a>.</p> |
Junio C Hamano | 33db437 | 2006-06-07 19:51:45 | [diff] [blame] | 288 | <p>The COMMAND is either a name of a Git command (see below) or an alias |
| 289 | as defined in the configuration file (see <a href="git-repo-config.html">git-repo-config(1)</a>).</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 290 | </div> |
| 291 | <h2>OPTIONS</h2> |
| 292 | <div class="sectionbody"> |
| 293 | <dl> |
| 294 | <dt> |
| 295 | --version |
| 296 | </dt> |
| 297 | <dd> |
| 298 | <p> |
Junio C Hamano | 0107892 | 2006-03-10 00:31:47 | [diff] [blame] | 299 | Prints the git suite version that the <em>git</em> program came from. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 300 | </p> |
| 301 | </dd> |
| 302 | <dt> |
| 303 | --help |
| 304 | </dt> |
| 305 | <dd> |
| 306 | <p> |
Junio C Hamano | 0107892 | 2006-03-10 00:31:47 | [diff] [blame] | 307 | 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 Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 311 | </p> |
| 312 | </dd> |
| 313 | <dt> |
| 314 | --exec-path |
| 315 | </dt> |
| 316 | <dd> |
| 317 | <p> |
Junio C Hamano | 0107892 | 2006-03-10 00:31:47 | [diff] [blame] | 318 | Path to wherever your core git programs are installed. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 319 | 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 Hamano | f870ef8 | 2006-07-29 09:10:13 | [diff] [blame] | 324 | <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=<path> |
| 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 Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 349 | </dl> |
| 350 | </div> |
Junio C Hamano | e27fb93 | 2006-04-03 05:34:10 | [diff] [blame] | 351 | <h2>FURTHER DOCUMENTATION</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 352 | <div class="sectionbody"> |
Junio C Hamano | e27fb93 | 2006-04-03 05:34:10 | [diff] [blame] | 353 | <p>See the references above to get started using git. The following is |
| 354 | probably 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 |
| 357 | underlying git architecture.</p> |
| 358 | <p>See also the <a href="howto-index.html">howto</a> documents for some useful |
| 359 | examples.</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 360 | </div> |
Junio C Hamano | e27fb93 | 2006-04-03 05:34:10 | [diff] [blame] | 361 | <h2>GIT COMMANDS</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 362 | <div class="sectionbody"> |
Junio C Hamano | e27fb93 | 2006-04-03 05:34:10 | [diff] [blame] | 363 | <p>We divide git into high level ("porcelain") commands and low level |
| 364 | ("plumbing") commands.</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 365 | </div> |
Junio C Hamano | e27fb93 | 2006-04-03 05:34:10 | [diff] [blame] | 366 | <h2>High-level commands (porcelain)</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 367 | <div class="sectionbody"> |
Junio C Hamano | e27fb93 | 2006-04-03 05:34:10 | [diff] [blame] | 368 | <p>We separate the porcelain commands into the main commands and some |
| 369 | ancillary user utilities.</p> |
| 370 | <h3>Main porcelain commands</h3> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 371 | <dl> |
| 372 | <dt> |
| 373 | <a href="git-add.html">git-add(1)</a> |
| 374 | </dt> |
| 375 | <dd> |
| 376 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 377 | Add file contents to the changeset to be committed next. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 378 | </p> |
| 379 | </dd> |
| 380 | <dt> |
| 381 | <a href="git-am.html">git-am(1)</a> |
| 382 | </dt> |
| 383 | <dd> |
| 384 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 385 | Apply a series of patches from a mailbox. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 386 | </p> |
| 387 | </dd> |
| 388 | <dt> |
Junio C Hamano | 817abb4 | 2006-09-26 07:16:58 | [diff] [blame] | 389 | <a href="git-archive.html">git-archive(1)</a> |
| 390 | </dt> |
| 391 | <dd> |
| 392 | <p> |
| 393 | Creates an archive of files from a named tree. |
| 394 | </p> |
| 395 | </dd> |
| 396 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 397 | <a href="git-bisect.html">git-bisect(1)</a> |
| 398 | </dt> |
| 399 | <dd> |
| 400 | <p> |
| 401 | Find the change that introduced a bug by binary search. |
| 402 | </p> |
| 403 | </dd> |
| 404 | <dt> |
| 405 | <a href="git-branch.html">git-branch(1)</a> |
| 406 | </dt> |
| 407 | <dd> |
| 408 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 409 | List, create, or delete branches. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 410 | </p> |
| 411 | </dd> |
| 412 | <dt> |
| 413 | <a href="git-checkout.html">git-checkout(1)</a> |
| 414 | </dt> |
| 415 | <dd> |
| 416 | <p> |
| 417 | Checkout and switch to a branch. |
| 418 | </p> |
| 419 | </dd> |
| 420 | <dt> |
| 421 | <a href="git-cherry-pick.html">git-cherry-pick(1)</a> |
| 422 | </dt> |
| 423 | <dd> |
| 424 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 425 | Apply the change introduced by an existing commit. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 426 | </p> |
| 427 | </dd> |
| 428 | <dt> |
Junio C Hamano | 54559c8 | 2006-04-13 07:45:12 | [diff] [blame] | 429 | <a href="git-clean.html">git-clean(1)</a> |
| 430 | </dt> |
| 431 | <dd> |
| 432 | <p> |
| 433 | Remove untracked files from the working tree. |
| 434 | </p> |
| 435 | </dd> |
| 436 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 437 | <a href="git-clone.html">git-clone(1)</a> |
| 438 | </dt> |
| 439 | <dd> |
| 440 | <p> |
| 441 | Clones a repository into a new directory. |
| 442 | </p> |
| 443 | </dd> |
| 444 | <dt> |
| 445 | <a href="git-commit.html">git-commit(1)</a> |
| 446 | </dt> |
| 447 | <dd> |
| 448 | <p> |
| 449 | Record changes to the repository. |
| 450 | </p> |
| 451 | </dd> |
| 452 | <dt> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 453 | <a href="git-describe.html">git-describe(1)</a> |
| 454 | </dt> |
| 455 | <dd> |
| 456 | <p> |
| 457 | Show the most recent tag that is reachable from a commit. |
| 458 | </p> |
| 459 | </dd> |
| 460 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 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> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 473 | Download objects and refs from another repository. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 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> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 485 | <a href="git-gc.html">git-gc(1)</a> |
| 486 | </dt> |
| 487 | <dd> |
| 488 | <p> |
| 489 | Cleanup unnecessary files and optimize the local repository. |
| 490 | </p> |
| 491 | </dd> |
| 492 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 493 | <a href="git-grep.html">git-grep(1)</a> |
| 494 | </dt> |
| 495 | <dd> |
| 496 | <p> |
| 497 | Print lines matching a pattern. |
| 498 | </p> |
| 499 | </dd> |
| 500 | <dt> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 501 | <a href="git-init.html">git-init(1)</a> |
| 502 | </dt> |
| 503 | <dd> |
| 504 | <p> |
| 505 | Create an empty git repository or reinitialize an existing one. |
| 506 | </p> |
| 507 | </dd> |
| 508 | <dt> |
Junio C Hamano | eb8e357 | 2006-09-01 08:25:07 | [diff] [blame] | 509 | <a href="gitk.html">gitk(1)</a> |
| 510 | </dt> |
| 511 | <dd> |
| 512 | <p> |
| 513 | The git repository browser. |
| 514 | </p> |
| 515 | </dd> |
| 516 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 517 | <a href="git-log.html">git-log(1)</a> |
| 518 | </dt> |
| 519 | <dd> |
| 520 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 521 | Show commit logs. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 522 | </p> |
| 523 | </dd> |
| 524 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 525 | <a href="git-merge.html">git-merge(1)</a> |
| 526 | </dt> |
| 527 | <dd> |
| 528 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 529 | Join two or more development histories together. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 530 | </p> |
| 531 | </dd> |
| 532 | <dt> |
| 533 | <a href="git-mv.html">git-mv(1)</a> |
| 534 | </dt> |
| 535 | <dd> |
| 536 | <p> |
| 537 | Move or rename a file, a directory, or a symlink. |
| 538 | </p> |
| 539 | </dd> |
| 540 | <dt> |
| 541 | <a href="git-pull.html">git-pull(1)</a> |
| 542 | </dt> |
| 543 | <dd> |
| 544 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 545 | Fetch from and merge with another repository or a local branch. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 546 | </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> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 561 | Forward-port local commits to the updated upstream head. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 562 | </p> |
| 563 | </dd> |
| 564 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 565 | <a href="git-reset.html">git-reset(1)</a> |
| 566 | </dt> |
| 567 | <dd> |
| 568 | <p> |
| 569 | Reset current HEAD to the specified state. |
| 570 | </p> |
| 571 | </dd> |
| 572 | <dt> |
| 573 | <a href="git-resolve.html">git-resolve(1)</a> |
| 574 | </dt> |
| 575 | <dd> |
| 576 | <p> |
| 577 | Merge two commits. |
| 578 | </p> |
| 579 | </dd> |
| 580 | <dt> |
| 581 | <a href="git-revert.html">git-revert(1)</a> |
| 582 | </dt> |
| 583 | <dd> |
| 584 | <p> |
| 585 | Revert an existing commit. |
| 586 | </p> |
| 587 | </dd> |
| 588 | <dt> |
Junio C Hamano | 54559c8 | 2006-04-13 07:45:12 | [diff] [blame] | 589 | <a href="git-rm.html">git-rm(1)</a> |
| 590 | </dt> |
| 591 | <dd> |
| 592 | <p> |
| 593 | Remove files from the working tree and from the index. |
| 594 | </p> |
| 595 | </dd> |
| 596 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 597 | <a href="git-shortlog.html">git-shortlog(1)</a> |
| 598 | </dt> |
| 599 | <dd> |
| 600 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 601 | Summarize <em>git log</em> output. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 602 | </p> |
| 603 | </dd> |
| 604 | <dt> |
Junio C Hamano | 2b13527 | 2006-03-18 07:45:42 | [diff] [blame] | 605 | <a href="git-show.html">git-show(1)</a> |
| 606 | </dt> |
| 607 | <dd> |
| 608 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 609 | Show various types of objects. |
Junio C Hamano | 2b13527 | 2006-03-18 07:45:42 | [diff] [blame] | 610 | </p> |
| 611 | </dd> |
| 612 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 613 | <a href="git-status.html">git-status(1)</a> |
| 614 | </dt> |
| 615 | <dd> |
| 616 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 617 | Show the working tree status. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 618 | </p> |
| 619 | </dd> |
| 620 | <dt> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 621 | <a href="git-tag.html">git-tag(1)</a> |
| 622 | </dt> |
| 623 | <dd> |
| 624 | <p> |
Junio C Hamano | db450ba | 2007-01-21 08:57:14 | [diff] [blame^] | 625 | Create, list, delete or verify a tag object signed with GPG. |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 626 | </p> |
| 627 | </dd> |
| 628 | </dl> |
| 629 | <h3>Ancillary Commands</h3> |
| 630 | <p>Manipulators:</p> |
| 631 | <dl> |
| 632 | <dt> |
| 633 | <a href="git-convert-objects.html">git-convert-objects(1)</a> |
| 634 | </dt> |
| 635 | <dd> |
| 636 | <p> |
| 637 | Converts old-style git repository. |
| 638 | </p> |
| 639 | </dd> |
| 640 | <dt> |
| 641 | <a href="git-lost-found.html">git-lost-found(1)</a> |
| 642 | </dt> |
| 643 | <dd> |
| 644 | <p> |
| 645 | Recover lost refs that luckily have not yet been pruned. |
| 646 | </p> |
| 647 | </dd> |
| 648 | <dt> |
| 649 | <a href="git-pack-refs.html">git-pack-refs(1)</a> |
| 650 | </dt> |
| 651 | <dd> |
| 652 | <p> |
| 653 | Pack heads and tags for efficient repository access. |
| 654 | </p> |
| 655 | </dd> |
| 656 | <dt> |
| 657 | <a href="git-prune.html">git-prune(1)</a> |
| 658 | </dt> |
| 659 | <dd> |
| 660 | <p> |
| 661 | Prunes all unreachable objects from the object database. |
| 662 | </p> |
| 663 | </dd> |
| 664 | <dt> |
| 665 | <a href="git-reflog.html">git-reflog(1)</a> |
| 666 | </dt> |
| 667 | <dd> |
| 668 | <p> |
| 669 | Manage reflog information. |
| 670 | </p> |
| 671 | </dd> |
| 672 | <dt> |
| 673 | <a href="git-relink.html">git-relink(1)</a> |
| 674 | </dt> |
| 675 | <dd> |
| 676 | <p> |
| 677 | Hardlink common objects in local repositories. |
| 678 | </p> |
| 679 | </dd> |
| 680 | <dt> |
| 681 | <a href="git-repack.html">git-repack(1)</a> |
| 682 | </dt> |
| 683 | <dd> |
| 684 | <p> |
| 685 | Pack unpacked objects in a repository. |
| 686 | </p> |
| 687 | </dd> |
| 688 | <dt> |
| 689 | <a href="git-repo-config.html">git-repo-config(1)</a> |
| 690 | </dt> |
| 691 | <dd> |
| 692 | <p> |
| 693 | Get and set repository or global options. |
| 694 | </p> |
| 695 | </dd> |
| 696 | </dl> |
| 697 | <p>Interrogators:</p> |
| 698 | <dl> |
| 699 | <dt> |
| 700 | <a href="git-annotate.html">git-annotate(1)</a> |
| 701 | </dt> |
| 702 | <dd> |
| 703 | <p> |
| 704 | Annotate file lines with commit info. |
| 705 | </p> |
| 706 | </dd> |
| 707 | <dt> |
| 708 | <a href="git-applymbox.html">git-applymbox(1)</a> |
| 709 | </dt> |
| 710 | <dd> |
| 711 | <p> |
| 712 | Apply a series of patches in a mailbox. |
| 713 | </p> |
| 714 | </dd> |
| 715 | <dt> |
| 716 | <a href="git-blame.html">git-blame(1)</a> |
| 717 | </dt> |
| 718 | <dd> |
| 719 | <p> |
| 720 | Show what revision and author last modified each line of a file. |
| 721 | </p> |
| 722 | </dd> |
| 723 | <dt> |
| 724 | <a href="git-cherry.html">git-cherry(1)</a> |
| 725 | </dt> |
| 726 | <dd> |
| 727 | <p> |
| 728 | Find commits not merged upstream. |
| 729 | </p> |
| 730 | </dd> |
| 731 | <dt> |
| 732 | <a href="git-count-objects.html">git-count-objects(1)</a> |
| 733 | </dt> |
| 734 | <dd> |
| 735 | <p> |
| 736 | Count unpacked number of objects and their disk consumption. |
| 737 | </p> |
| 738 | </dd> |
| 739 | <dt> |
| 740 | <a href="git-fsck-objects.html">git-fsck-objects(1)</a> |
| 741 | </dt> |
| 742 | <dd> |
| 743 | <p> |
| 744 | Verifies the connectivity and validity of the objects in the database. |
| 745 | </p> |
| 746 | </dd> |
| 747 | <dt> |
| 748 | <a href="git-get-tar-commit-id.html">git-get-tar-commit-id(1)</a> |
| 749 | </dt> |
| 750 | <dd> |
| 751 | <p> |
| 752 | Extract commit ID from an archive created using git-tar-tree. |
| 753 | </p> |
| 754 | </dd> |
| 755 | <dt> |
| 756 | <a href="git-instaweb.html">git-instaweb(1)</a> |
| 757 | </dt> |
| 758 | <dd> |
| 759 | <p> |
| 760 | Instantly browse your working repository in gitweb. |
| 761 | </p> |
| 762 | </dd> |
| 763 | <dt> |
| 764 | <a href="git-merge-tree.html">git-merge-tree(1)</a> |
| 765 | </dt> |
| 766 | <dd> |
| 767 | <p> |
| 768 | Show three-way merge without touching index. |
| 769 | </p> |
| 770 | </dd> |
| 771 | <dt> |
| 772 | <a href="git-rerere.html">git-rerere(1)</a> |
| 773 | </dt> |
| 774 | <dd> |
| 775 | <p> |
| 776 | Reuse recorded resolution of conflicted merges. |
| 777 | </p> |
| 778 | </dd> |
| 779 | <dt> |
| 780 | <a href="git-rev-parse.html">git-rev-parse(1)</a> |
| 781 | </dt> |
| 782 | <dd> |
| 783 | <p> |
| 784 | Pick out and massage parameters. |
| 785 | </p> |
| 786 | </dd> |
| 787 | <dt> |
| 788 | <a href="git-runstatus.html">git-runstatus(1)</a> |
| 789 | </dt> |
| 790 | <dd> |
| 791 | <p> |
| 792 | A helper for git-status and git-commit. |
| 793 | </p> |
| 794 | </dd> |
| 795 | <dt> |
| 796 | <a href="git-show-branch.html">git-show-branch(1)</a> |
| 797 | </dt> |
| 798 | <dd> |
| 799 | <p> |
| 800 | Show branches and their commits. |
| 801 | </p> |
| 802 | </dd> |
| 803 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 804 | <a href="git-verify-tag.html">git-verify-tag(1)</a> |
| 805 | </dt> |
| 806 | <dd> |
| 807 | <p> |
| 808 | Check the GPG signature of tag. |
| 809 | </p> |
| 810 | </dd> |
| 811 | <dt> |
| 812 | <a href="git-whatchanged.html">git-whatchanged(1)</a> |
| 813 | </dt> |
| 814 | <dd> |
| 815 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 816 | Show logs with difference each commit introduces. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 817 | </p> |
| 818 | </dd> |
| 819 | </dl> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 820 | <h3>Interacting with Others</h3> |
| 821 | <p>These commands are to interact with foreign SCM and with other |
| 822 | people via patch over e-mail.</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 823 | <dl> |
| 824 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 825 | <a href="git-archimport.html">git-archimport(1)</a> |
| 826 | </dt> |
| 827 | <dd> |
| 828 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 829 | Import an Arch repository into git. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 830 | </p> |
| 831 | </dd> |
| 832 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 833 | <a href="git-cvsexportcommit.html">git-cvsexportcommit(1)</a> |
| 834 | </dt> |
| 835 | <dd> |
| 836 | <p> |
| 837 | Export a single commit to a CVS checkout. |
| 838 | </p> |
| 839 | </dd> |
| 840 | <dt> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 841 | <a href="git-cvsimport.html">git-cvsimport(1)</a> |
| 842 | </dt> |
| 843 | <dd> |
| 844 | <p> |
| 845 | Salvage your data out of another SCM people love to hate. |
| 846 | </p> |
| 847 | </dd> |
| 848 | <dt> |
Junio C Hamano | 54559c8 | 2006-04-13 07:45:12 | [diff] [blame] | 849 | <a href="git-cvsserver.html">git-cvsserver(1)</a> |
| 850 | </dt> |
| 851 | <dd> |
| 852 | <p> |
| 853 | A CVS server emulator for git. |
| 854 | </p> |
| 855 | </dd> |
| 856 | <dt> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 857 | <a href="git-imap-send.html">git-imap-send(1)</a> |
Junio C Hamano | 5229946 | 2006-12-28 00:59:38 | [diff] [blame] | 858 | </dt> |
| 859 | <dd> |
| 860 | <p> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 861 | Dump a mailbox from stdin into an imap folder. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 862 | </p> |
| 863 | </dd> |
| 864 | <dt> |
Junio C Hamano | 33db437 | 2006-06-07 19:51:45 | [diff] [blame] | 865 | <a href="git-quiltimport.html">git-quiltimport(1)</a> |
| 866 | </dt> |
| 867 | <dd> |
| 868 | <p> |
| 869 | Applies a quilt patchset onto the current branch. |
| 870 | </p> |
| 871 | </dd> |
| 872 | <dt> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 873 | <a href="git-request-pull.html">git-request-pull(1)</a> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 874 | </dt> |
| 875 | <dd> |
| 876 | <p> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 877 | Generates a summary of pending changes. |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 878 | </p> |
| 879 | </dd> |
| 880 | <dt> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 881 | <a href="git-send-email.html">git-send-email(1)</a> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 882 | </dt> |
| 883 | <dd> |
| 884 | <p> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 885 | Send a collection of patches as emails. |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 886 | </p> |
| 887 | </dd> |
| 888 | <dt> |
Junio C Hamano | b518f45 | 2006-08-04 00:18:06 | [diff] [blame] | 889 | <a href="git-svn.html">git-svn(1)</a> |
| 890 | </dt> |
| 891 | <dd> |
| 892 | <p> |
| 893 | Bidirectional operation between a single Subversion branch and git. |
| 894 | </p> |
| 895 | </dd> |
| 896 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 897 | <a href="git-svnimport.html">git-svnimport(1)</a> |
| 898 | </dt> |
| 899 | <dd> |
| 900 | <p> |
| 901 | Import a SVN repository into git. |
| 902 | </p> |
| 903 | </dd> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 904 | </dl> |
| 905 | </div> |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 906 | <h2>Low-level commands (plumbing)</h2> |
| 907 | <div class="sectionbody"> |
| 908 | <p>Although git includes its |
| 909 | own porcelain layer, its low-level commands are sufficient to support |
| 910 | development of alternative porcelains. Developers of such porcelains |
| 911 | might start by reading about <a href="git-update-index.html">git-update-index(1)</a> and |
| 912 | <a href="git-read-tree.html">git-read-tree(1)</a>.</p> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 913 | <p>The interface (input, output, set of options and the semantics) |
| 914 | to these low-level commands are meant to be a lot more stable |
| 915 | than Porcelain level commands, because these commands are |
| 916 | primarily for scripted use. The interface to Porcelain commands |
| 917 | on the other hand are subject to change in order to improve the |
| 918 | end user experience.</p> |
| 919 | <p>The following description divides |
| 920 | the low-level commands into commands that manipulate objects (in |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 921 | the repository, index, and working tree), commands that interrogate and |
| 922 | compare objects, and commands that move objects and references between |
| 923 | repositories.</p> |
| 924 | <h3>Manipulation commands</h3> |
| 925 | <dl> |
| 926 | <dt> |
| 927 | <a href="git-apply.html">git-apply(1)</a> |
| 928 | </dt> |
| 929 | <dd> |
| 930 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 931 | Apply a patch on a git index file and a working tree. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 932 | </p> |
| 933 | </dd> |
| 934 | <dt> |
| 935 | <a href="git-checkout-index.html">git-checkout-index(1)</a> |
| 936 | </dt> |
| 937 | <dd> |
| 938 | <p> |
| 939 | Copy files from the index to the working tree. |
| 940 | </p> |
| 941 | </dd> |
| 942 | <dt> |
| 943 | <a href="git-commit-tree.html">git-commit-tree(1)</a> |
| 944 | </dt> |
| 945 | <dd> |
| 946 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 947 | Create a new commit object. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 948 | </p> |
| 949 | </dd> |
| 950 | <dt> |
| 951 | <a href="git-hash-object.html">git-hash-object(1)</a> |
| 952 | </dt> |
| 953 | <dd> |
| 954 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 955 | Compute object ID and optionally creates a blob from a file. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 956 | </p> |
| 957 | </dd> |
| 958 | <dt> |
| 959 | <a href="git-index-pack.html">git-index-pack(1)</a> |
| 960 | </dt> |
| 961 | <dd> |
| 962 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 963 | Build pack index file for an existing packed archive. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 964 | </p> |
| 965 | </dd> |
| 966 | <dt> |
Junio C Hamano | 1de7bc6 | 2006-12-17 19:31:54 | [diff] [blame] | 967 | <a href="git-merge-file.html">git-merge-file(1)</a> |
| 968 | </dt> |
| 969 | <dd> |
| 970 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 971 | Run a three-way file merge. |
Junio C Hamano | 1de7bc6 | 2006-12-17 19:31:54 | [diff] [blame] | 972 | </p> |
| 973 | </dd> |
| 974 | <dt> |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 975 | <a href="git-merge-index.html">git-merge-index(1)</a> |
| 976 | </dt> |
| 977 | <dd> |
| 978 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 979 | Run a merge for files needing merging. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 980 | </p> |
| 981 | </dd> |
| 982 | <dt> |
| 983 | <a href="git-mktag.html">git-mktag(1)</a> |
| 984 | </dt> |
| 985 | <dd> |
| 986 | <p> |
| 987 | Creates a tag object. |
| 988 | </p> |
| 989 | </dd> |
| 990 | <dt> |
| 991 | <a href="git-mktree.html">git-mktree(1)</a> |
| 992 | </dt> |
| 993 | <dd> |
| 994 | <p> |
| 995 | Build a tree-object from ls-tree formatted text. |
| 996 | </p> |
| 997 | </dd> |
| 998 | <dt> |
| 999 | <a href="git-pack-objects.html">git-pack-objects(1)</a> |
| 1000 | </dt> |
| 1001 | <dd> |
| 1002 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1003 | Create a packed archive of objects. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1004 | </p> |
| 1005 | </dd> |
| 1006 | <dt> |
| 1007 | <a href="git-prune-packed.html">git-prune-packed(1)</a> |
| 1008 | </dt> |
| 1009 | <dd> |
| 1010 | <p> |
| 1011 | Remove extra objects that are already in pack files. |
| 1012 | </p> |
| 1013 | </dd> |
| 1014 | <dt> |
| 1015 | <a href="git-read-tree.html">git-read-tree(1)</a> |
| 1016 | </dt> |
| 1017 | <dd> |
| 1018 | <p> |
| 1019 | Reads tree information into the index. |
| 1020 | </p> |
| 1021 | </dd> |
| 1022 | <dt> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 1023 | <a href="git-symbolic-ref.html">git-symbolic-ref(1)</a> |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1024 | </dt> |
| 1025 | <dd> |
| 1026 | <p> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 1027 | Read and modify symbolic refs. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1028 | </p> |
| 1029 | </dd> |
| 1030 | <dt> |
| 1031 | <a href="git-unpack-objects.html">git-unpack-objects(1)</a> |
| 1032 | </dt> |
| 1033 | <dd> |
| 1034 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1035 | Unpack objects from a packed archive. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1036 | </p> |
| 1037 | </dd> |
| 1038 | <dt> |
| 1039 | <a href="git-update-index.html">git-update-index(1)</a> |
| 1040 | </dt> |
| 1041 | <dd> |
| 1042 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1043 | Register file contents in the working tree to the index. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1044 | </p> |
| 1045 | </dd> |
| 1046 | <dt> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 1047 | <a href="git-update-ref.html">git-update-ref(1)</a> |
| 1048 | </dt> |
| 1049 | <dd> |
| 1050 | <p> |
| 1051 | Update the object name stored in a ref safely. |
| 1052 | </p> |
| 1053 | </dd> |
| 1054 | <dt> |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1055 | <a href="git-write-tree.html">git-write-tree(1)</a> |
| 1056 | </dt> |
| 1057 | <dd> |
| 1058 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1059 | Create a tree object from the current index. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1060 | </p> |
| 1061 | </dd> |
| 1062 | </dl> |
| 1063 | <h3>Interrogation commands</h3> |
| 1064 | <dl> |
| 1065 | <dt> |
| 1066 | <a href="git-cat-file.html">git-cat-file(1)</a> |
| 1067 | </dt> |
| 1068 | <dd> |
| 1069 | <p> |
| 1070 | Provide content or type/size information for repository objects. |
| 1071 | </p> |
| 1072 | </dd> |
| 1073 | <dt> |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1074 | <a href="git-diff-files.html">git-diff-files(1)</a> |
| 1075 | </dt> |
| 1076 | <dd> |
| 1077 | <p> |
| 1078 | Compares files in the working tree and the index. |
| 1079 | </p> |
| 1080 | </dd> |
| 1081 | <dt> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1082 | <a href="git-diff-index.html">git-diff-index(1)</a> |
| 1083 | </dt> |
| 1084 | <dd> |
| 1085 | <p> |
| 1086 | Compares content and mode of blobs between the index and repository. |
| 1087 | </p> |
| 1088 | </dd> |
| 1089 | <dt> |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1090 | <a href="git-diff-stages.html">git-diff-stages(1)</a> |
| 1091 | </dt> |
| 1092 | <dd> |
| 1093 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1094 | Compares two merge stages in the index. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1095 | </p> |
| 1096 | </dd> |
| 1097 | <dt> |
| 1098 | <a href="git-diff-tree.html">git-diff-tree(1)</a> |
| 1099 | </dt> |
| 1100 | <dd> |
| 1101 | <p> |
| 1102 | Compares the content and mode of blobs found via two tree objects. |
| 1103 | </p> |
| 1104 | </dd> |
| 1105 | <dt> |
| 1106 | <a href="git-for-each-ref.html">git-for-each-ref(1)</a> |
| 1107 | </dt> |
| 1108 | <dd> |
| 1109 | <p> |
| 1110 | Output information on each ref. |
| 1111 | </p> |
| 1112 | </dd> |
| 1113 | <dt> |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1114 | <a href="git-ls-files.html">git-ls-files(1)</a> |
| 1115 | </dt> |
| 1116 | <dd> |
| 1117 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1118 | Show information about files in the index and the working tree. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1119 | </p> |
| 1120 | </dd> |
| 1121 | <dt> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 1122 | <a href="git-ls-remote.html">git-ls-remote(1)</a> |
| 1123 | </dt> |
| 1124 | <dd> |
| 1125 | <p> |
| 1126 | List references in a remote repository. |
| 1127 | </p> |
| 1128 | </dd> |
| 1129 | <dt> |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1130 | <a href="git-ls-tree.html">git-ls-tree(1)</a> |
| 1131 | </dt> |
| 1132 | <dd> |
| 1133 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1134 | List the contents of a tree object. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1135 | </p> |
| 1136 | </dd> |
| 1137 | <dt> |
| 1138 | <a href="git-merge-base.html">git-merge-base(1)</a> |
| 1139 | </dt> |
| 1140 | <dd> |
| 1141 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1142 | Find as good common ancestors as possible for a merge. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1143 | </p> |
| 1144 | </dd> |
| 1145 | <dt> |
| 1146 | <a href="git-name-rev.html">git-name-rev(1)</a> |
| 1147 | </dt> |
| 1148 | <dd> |
| 1149 | <p> |
| 1150 | Find symbolic names for given revs. |
| 1151 | </p> |
| 1152 | </dd> |
| 1153 | <dt> |
| 1154 | <a href="git-pack-redundant.html">git-pack-redundant(1)</a> |
| 1155 | </dt> |
| 1156 | <dd> |
| 1157 | <p> |
| 1158 | Find redundant pack files. |
| 1159 | </p> |
| 1160 | </dd> |
| 1161 | <dt> |
| 1162 | <a href="git-rev-list.html">git-rev-list(1)</a> |
| 1163 | </dt> |
| 1164 | <dd> |
| 1165 | <p> |
| 1166 | Lists commit objects in reverse chronological order. |
| 1167 | </p> |
| 1168 | </dd> |
| 1169 | <dt> |
| 1170 | <a href="git-show-index.html">git-show-index(1)</a> |
| 1171 | </dt> |
| 1172 | <dd> |
| 1173 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1174 | Show packed archive index. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1175 | </p> |
| 1176 | </dd> |
| 1177 | <dt> |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 1178 | <a href="git-show-ref.html">git-show-ref(1)</a> |
| 1179 | </dt> |
| 1180 | <dd> |
| 1181 | <p> |
| 1182 | List references in a local repository. |
| 1183 | </p> |
| 1184 | </dd> |
| 1185 | <dt> |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1186 | <a href="git-tar-tree.html">git-tar-tree(1)</a> |
| 1187 | </dt> |
| 1188 | <dd> |
| 1189 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1190 | Create a tar archive of the files in the named tree object. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1191 | </p> |
| 1192 | </dd> |
| 1193 | <dt> |
| 1194 | <a href="git-unpack-file.html">git-unpack-file(1)</a> |
| 1195 | </dt> |
| 1196 | <dd> |
| 1197 | <p> |
| 1198 | Creates a temporary file with a blob's contents. |
| 1199 | </p> |
| 1200 | </dd> |
| 1201 | <dt> |
| 1202 | <a href="git-var.html">git-var(1)</a> |
| 1203 | </dt> |
| 1204 | <dd> |
| 1205 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1206 | Show a git logical variable. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1207 | </p> |
| 1208 | </dd> |
| 1209 | <dt> |
| 1210 | <a href="git-verify-pack.html">git-verify-pack(1)</a> |
| 1211 | </dt> |
| 1212 | <dd> |
| 1213 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1214 | Validate packed git archive files. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1215 | </p> |
| 1216 | </dd> |
| 1217 | </dl> |
| 1218 | <p>In general, the interrogate commands do not touch the files in |
| 1219 | the working tree.</p> |
| 1220 | <h3>Synching repositories</h3> |
| 1221 | <dl> |
| 1222 | <dt> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 1223 | <a href="git-daemon.html">git-daemon(1)</a> |
| 1224 | </dt> |
| 1225 | <dd> |
| 1226 | <p> |
| 1227 | A really simple server for git repositories. |
| 1228 | </p> |
| 1229 | </dd> |
| 1230 | <dt> |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1231 | <a href="git-fetch-pack.html">git-fetch-pack(1)</a> |
| 1232 | </dt> |
| 1233 | <dd> |
| 1234 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1235 | Receive missing objects from another repository. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1236 | </p> |
| 1237 | </dd> |
| 1238 | <dt> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1239 | <a href="git-local-fetch.html">git-local-fetch(1)</a> |
| 1240 | </dt> |
| 1241 | <dd> |
| 1242 | <p> |
| 1243 | Duplicate another git repository on a local system. |
| 1244 | </p> |
| 1245 | </dd> |
| 1246 | <dt> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1247 | <a href="git-send-pack.html">git-send-pack(1)</a> |
| 1248 | </dt> |
| 1249 | <dd> |
| 1250 | <p> |
| 1251 | Push objects over git protocol to another reposiotory. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1252 | </p> |
| 1253 | </dd> |
| 1254 | <dt> |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1255 | <a href="git-ssh-fetch.html">git-ssh-fetch(1)</a> |
| 1256 | </dt> |
| 1257 | <dd> |
| 1258 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1259 | Fetch from a remote repository over ssh connection. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1260 | </p> |
| 1261 | </dd> |
| 1262 | <dt> |
| 1263 | <a href="git-ssh-upload.html">git-ssh-upload(1)</a> |
| 1264 | </dt> |
| 1265 | <dd> |
| 1266 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1267 | Push to a remote repository over ssh connection. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1268 | </p> |
| 1269 | </dd> |
| 1270 | <dt> |
| 1271 | <a href="git-update-server-info.html">git-update-server-info(1)</a> |
| 1272 | </dt> |
| 1273 | <dd> |
| 1274 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1275 | Update auxiliary info file to help dumb servers. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1276 | </p> |
| 1277 | </dd> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 1278 | </dl> |
| 1279 | <p>The following are helper programs used by the above; end users |
| 1280 | typically do not use them directly.</p> |
| 1281 | <dl> |
| 1282 | <dt> |
| 1283 | <a href="git-http-fetch.html">git-http-fetch(1)</a> |
| 1284 | </dt> |
| 1285 | <dd> |
| 1286 | <p> |
| 1287 | Download from a remote git repository via HTTP. |
| 1288 | </p> |
| 1289 | </dd> |
| 1290 | <dt> |
| 1291 | <a href="git-http-push.html">git-http-push(1)</a> |
| 1292 | </dt> |
| 1293 | <dd> |
| 1294 | <p> |
| 1295 | Push objects over HTTP/DAV to another repository. |
| 1296 | </p> |
| 1297 | </dd> |
| 1298 | <dt> |
| 1299 | <a href="git-parse-remote.html">git-parse-remote(1)</a> |
| 1300 | </dt> |
| 1301 | <dd> |
| 1302 | <p> |
| 1303 | Routines to help parsing remote repository access parameters. |
| 1304 | </p> |
| 1305 | </dd> |
| 1306 | <dt> |
| 1307 | <a href="git-receive-pack.html">git-receive-pack(1)</a> |
| 1308 | </dt> |
| 1309 | <dd> |
| 1310 | <p> |
| 1311 | Receive what is pushed into the repository. |
| 1312 | </p> |
| 1313 | </dd> |
| 1314 | <dt> |
| 1315 | <a href="git-shell.html">git-shell(1)</a> |
| 1316 | </dt> |
| 1317 | <dd> |
| 1318 | <p> |
| 1319 | Restricted login shell for GIT-only SSH access. |
| 1320 | </p> |
| 1321 | </dd> |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1322 | <dt> |
| 1323 | <a href="git-upload-archive.html">git-upload-archive(1)</a> |
| 1324 | </dt> |
| 1325 | <dd> |
| 1326 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1327 | Send archive back to git-archive. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1328 | </p> |
| 1329 | </dd> |
| 1330 | <dt> |
| 1331 | <a href="git-upload-pack.html">git-upload-pack(1)</a> |
| 1332 | </dt> |
| 1333 | <dd> |
| 1334 | <p> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 1335 | Send objects packed back to git-fetch-pack. |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1336 | </p> |
| 1337 | </dd> |
| 1338 | </dl> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 1339 | <h3>Internal helper commands</h3> |
| 1340 | <p>These are internal helper commands used by other commands; end |
| 1341 | users typically do not use them directly.</p> |
| 1342 | <dl> |
| 1343 | <dt> |
| 1344 | <a href="git-applypatch.html">git-applypatch(1)</a> |
| 1345 | </dt> |
| 1346 | <dd> |
| 1347 | <p> |
| 1348 | Apply one patch extracted from an e-mail. |
| 1349 | </p> |
| 1350 | </dd> |
| 1351 | <dt> |
| 1352 | <a href="git-check-ref-format.html">git-check-ref-format(1)</a> |
| 1353 | </dt> |
| 1354 | <dd> |
| 1355 | <p> |
| 1356 | Make sure ref name is well formed. |
| 1357 | </p> |
| 1358 | </dd> |
| 1359 | <dt> |
| 1360 | <a href="git-fmt-merge-msg.html">git-fmt-merge-msg(1)</a> |
| 1361 | </dt> |
| 1362 | <dd> |
| 1363 | <p> |
| 1364 | Produce a merge commit message. |
| 1365 | </p> |
| 1366 | </dd> |
| 1367 | <dt> |
| 1368 | <a href="git-mailinfo.html">git-mailinfo(1)</a> |
| 1369 | </dt> |
| 1370 | <dd> |
| 1371 | <p> |
| 1372 | Extracts patch and authorship from a single e-mail message. |
| 1373 | </p> |
| 1374 | </dd> |
| 1375 | <dt> |
| 1376 | <a href="git-mailsplit.html">git-mailsplit(1)</a> |
| 1377 | </dt> |
| 1378 | <dd> |
| 1379 | <p> |
| 1380 | Simple UNIX mbox splitter program. |
| 1381 | </p> |
| 1382 | </dd> |
| 1383 | <dt> |
| 1384 | <a href="git-merge-one-file.html">git-merge-one-file(1)</a> |
| 1385 | </dt> |
| 1386 | <dd> |
| 1387 | <p> |
| 1388 | The standard helper program to use with git-merge-index. |
| 1389 | </p> |
| 1390 | </dd> |
| 1391 | <dt> |
| 1392 | <a href="git-patch-id.html">git-patch-id(1)</a> |
| 1393 | </dt> |
| 1394 | <dd> |
| 1395 | <p> |
| 1396 | Compute unique ID for a patch. |
| 1397 | </p> |
| 1398 | </dd> |
| 1399 | <dt> |
| 1400 | <a href="git-peek-remote.html">git-peek-remote(1)</a> |
| 1401 | </dt> |
| 1402 | <dd> |
| 1403 | <p> |
| 1404 | List the references in a remote repository. |
| 1405 | </p> |
| 1406 | </dd> |
| 1407 | <dt> |
| 1408 | <a href="git-sh-setup.html">git-sh-setup(1)</a> |
| 1409 | </dt> |
| 1410 | <dd> |
| 1411 | <p> |
| 1412 | Common git shell script setup code. |
| 1413 | </p> |
| 1414 | </dd> |
| 1415 | <dt> |
| 1416 | <a href="git-stripspace.html">git-stripspace(1)</a> |
| 1417 | </dt> |
| 1418 | <dd> |
| 1419 | <p> |
| 1420 | Filter out empty lines. |
| 1421 | </p> |
| 1422 | </dd> |
| 1423 | </dl> |
Junio C Hamano | b19b4f0 | 2006-10-29 20:47:22 | [diff] [blame] | 1424 | </div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1425 | <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 |
| 1428 | is used to hold per-repository configuration options. It is a |
Junio C Hamano | 51c2ab0 | 2006-07-09 20:38:54 | [diff] [blame] | 1429 | simple text file modeled after <tt>.ini</tt> format familiar to some |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1430 | people. 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 |
| 1449 | their operation accordingly.</p> |
| 1450 | </div> |
| 1451 | <h2>Identifier Terminology</h2> |
| 1452 | <div class="sectionbody"> |
| 1453 | <dl> |
| 1454 | <dt> |
| 1455 | <object> |
| 1456 | </dt> |
| 1457 | <dd> |
| 1458 | <p> |
| 1459 | Indicates the object name for any type of object. |
| 1460 | </p> |
| 1461 | </dd> |
| 1462 | <dt> |
| 1463 | <blob> |
| 1464 | </dt> |
| 1465 | <dd> |
| 1466 | <p> |
| 1467 | Indicates a blob object name. |
| 1468 | </p> |
| 1469 | </dd> |
| 1470 | <dt> |
| 1471 | <tree> |
| 1472 | </dt> |
| 1473 | <dd> |
| 1474 | <p> |
| 1475 | Indicates a tree object name. |
| 1476 | </p> |
| 1477 | </dd> |
| 1478 | <dt> |
| 1479 | <commit> |
| 1480 | </dt> |
| 1481 | <dd> |
| 1482 | <p> |
| 1483 | Indicates a commit object name. |
| 1484 | </p> |
| 1485 | </dd> |
| 1486 | <dt> |
| 1487 | <tree-ish> |
| 1488 | </dt> |
| 1489 | <dd> |
| 1490 | <p> |
| 1491 | Indicates a tree, commit or tag object name. A |
| 1492 | command that takes a <tree-ish> argument ultimately wants to |
| 1493 | operate on a <tree> object but automatically dereferences |
| 1494 | <commit> and <tag> objects that point at a <tree>. |
| 1495 | </p> |
| 1496 | </dd> |
| 1497 | <dt> |
| 1498 | <type> |
| 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 | <file> |
| 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 <object> can also use the following |
| 1520 | symbolic notation:</p> |
| 1521 | <dl> |
| 1522 | <dt> |
| 1523 | HEAD |
| 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 | <tag> |
| 1533 | </dt> |
| 1534 | <dd> |
| 1535 | <p> |
| 1536 | a valid tag <em>name</em> |
| 1537 | (i.e. the contents of <tt>$GIT_DIR/refs/tags/<tag></tt>). |
| 1538 | </p> |
| 1539 | </dd> |
| 1540 | <dt> |
| 1541 | <head> |
| 1542 | </dt> |
| 1543 | <dd> |
| 1544 | <p> |
| 1545 | a valid head <em>name</em> |
| 1546 | (i.e. the contents of <tt>$GIT_DIR/refs/heads/<head></tt>). |
| 1547 | </p> |
| 1548 | </dd> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1549 | </dl> |
Junio C Hamano | ff4b431 | 2006-10-25 22:55:31 | [diff] [blame] | 1550 | <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 Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1552 | </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 Hamano | 818f7d6 | 2006-03-26 01:49:30 | [diff] [blame] | 1556 | <p>Read <a href="hooks.html">hooks</a> for more details about each hook.</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1557 | <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 |
| 1569 | is worth noting that they may be used/overridden by SCMS sitting above |
| 1570 | git 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 Hamano | 1c43712 | 2006-11-28 02:22:25 | [diff] [blame] | 1644 | <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 Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1652 | <dt> |
| 1653 | <em>GIT_EXTERNAL_DIFF</em> |
| 1654 | </dt> |
| 1655 | <dd> |
| 1656 | <p> |
Junio C Hamano | 1c43712 | 2006-11-28 02:22:25 | [diff] [blame] | 1657 | 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 Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1661 | </p> |
Junio C Hamano | 1c43712 | 2006-11-28 02:22:25 | [diff] [blame] | 1662 | <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 | <old|new>-file |
| 1671 | </td> |
| 1672 | <td class="hlist2"> |
| 1673 | are files GIT_EXTERNAL_DIFF can use to read the |
| 1674 | contents of <old|new>, |
| 1675 | </td> |
| 1676 | </tr> |
| 1677 | <tr> |
| 1678 | <td class="hlist1"> |
| 1679 | <old|new>-hex |
| 1680 | </td> |
| 1681 | <td class="hlist2"> |
| 1682 | are the 40-hexdigit SHA1 hashes, |
| 1683 | </td> |
| 1684 | </tr> |
| 1685 | <tr> |
| 1686 | <td class="hlist1"> |
| 1687 | <old|new>-mode |
| 1688 | </td> |
| 1689 | <td class="hlist2"> |
| 1690 | are 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> |
| 1696 | when a new file is added), or a temporary file (e.g. <tt>old-file</tt> in the |
| 1697 | index). <em>GIT_EXTERNAL_DIFF</em> should not worry about unlinking the |
| 1698 | temporary 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 |
| 1700 | parameter, <path>.</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1701 | </dd> |
| 1702 | </dl> |
Junio C Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 1703 | <h3>other</h3> |
| 1704 | <dl> |
| 1705 | <dt> |
Junio C Hamano | 85e45fa | 2006-08-13 07:47:41 | [diff] [blame] | 1706 | <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 Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 1714 | <em>GIT_TRACE</em> |
| 1715 | </dt> |
| 1716 | <dd> |
| 1717 | <p> |
Junio C Hamano | ef4b48b | 2006-09-04 10:08:34 | [diff] [blame] | 1718 | 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 Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 1720 | stderr telling about alias expansion, built-in command |
| 1721 | execution and external command execution. |
Junio C Hamano | ef4b48b | 2006-09-04 10:08:34 | [diff] [blame] | 1722 | 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 Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 1730 | </p> |
| 1731 | </dd> |
| 1732 | </dl> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1733 | </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> |
| 1740 | random 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> |
| 1747 | stupid. 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> |
Junio C Hamano | 4f9a605 | 2007-01-17 20:25:16 | [diff] [blame] | 1763 | <p>This is a (not so) stupid but extremely fast directory content manager. |
| 1764 | It doesn't do a whole lot at its core, but what it <em>does</em> do is track |
| 1765 | directory contents efficiently.</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 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 |
| 1770 | of objects. All objects are named by their content, which is |
| 1771 | approximated by the SHA1 hash of the object itself. Objects may refer |
| 1772 | to other objects (by referencing their SHA1 hash), and so you can |
| 1773 | build up a hierarchy of objects.</p> |
| 1774 | <p>All objects have a statically determined "type" aka "tag", which is |
| 1775 | determined at object creation time, and which identifies the format of |
| 1776 | the object (i.e. how it is used, and how it can refer to other |
| 1777 | objects). 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 |
| 1780 | implies, a pure storage object containing some user data. It is used to |
| 1781 | actually store the file data, i.e. a blob object is associated with some |
| 1782 | particular version of some file.</p> |
| 1783 | <p>A "tree" object is an object that ties one or more "blob" objects into a |
| 1784 | directory structure. In addition, a tree object can refer to other tree |
| 1785 | objects, thus creating a directory hierarchy.</p> |
| 1786 | <p>A "commit" object ties such directory hierarchies together into |
| 1787 | a 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 |
| 1790 | history 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" |
| 1792 | object, and is the point of an initial project commit. Each project |
| 1793 | must have at least one root, and while you can tie several different |
| 1794 | root objects together into one project by creating a commit object which |
| 1795 | has two or more separate roots as its ultimate parents, that's probably |
| 1796 | just going to confuse people. So aim for the notion of "one root object |
| 1797 | per project", even if git itself does not enforce that.</p> |
| 1798 | <p>A "tag" object symbolically identifies and can be used to sign other |
| 1799 | objects. It contains the identifier and type of another object, a |
| 1800 | symbolic name (of course!) and, optionally, a signature.</p> |
| 1801 | <p>Regardless of object type, all objects share the following |
| 1802 | characteristics: they are all deflated with zlib, and have a header |
| 1803 | that not only specifies their type, but also provides size information |
| 1804 | about the data in the object. It's worth noting that the SHA1 hash |
| 1805 | that is used to name the object is the hash of the original data |
| 1806 | plus this header, so <tt>sha1sum</tt> <em>file</em> does not match the object name |
| 1807 | for <em>file</em>. |
| 1808 | (Historical note: in the dawn of the age of git the hash |
| 1809 | was the sha1 of the <em>compressed</em> object.)</p> |
| 1810 | <p>As a result, the general consistency of an object can always be tested |
| 1811 | independently of the contents or the type of the object: all objects can |
| 1812 | be validated by verifying that (a) their hashes match the content of the |
| 1813 | file and (b) the object successfully inflates to a stream of bytes that |
| 1814 | forms a sequence of <ascii type without space> + <space> + <ascii decimal |
| 1815 | size> + <byte\0> + <binary object data>.</p> |
| 1816 | <p>The structured objects can further have their structure and |
| 1817 | connectivity to other objects verified. This is generally done with |
| 1818 | the <tt>git-fsck-objects</tt> program, which generates a full dependency graph |
| 1819 | of all objects, and verifies their internal consistency (in addition |
| 1820 | to 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 |
| 1824 | refer to anything else. There is no signature or any other |
| 1825 | verification of the data, so while the object is consistent (it <em>is</em> |
| 1826 | indexed by its sha1 hash, so the data itself is certainly correct), it |
| 1827 | has absolutely no other attributes. No name associations, no |
| 1828 | permissions. It is purely a blob of data (i.e. normally "file |
| 1829 | contents").</p> |
| 1830 | <p>In particular, since the blob is entirely defined by its data, if two |
| 1831 | files in a directory tree (or in multiple different versions of the |
| 1832 | repository) have the same contents, they will share the same blob |
| 1833 | object. The object is totally independent of its location in the |
| 1834 | directory tree, and renaming a file does not change the object that |
| 1835 | file 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> |
| 1837 | is 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 |
| 1840 | is a list of mode/name/blob data, sorted by name. Alternatively, the |
| 1841 | mode data may specify a directory mode, in which case instead of |
| 1842 | naming 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 |
| 1844 | set contents, and so two separate but identical trees will always |
| 1845 | share the exact same object. This is true at all levels, i.e. it's |
| 1846 | true for a "leaf" tree (which does not refer to any other trees, only |
| 1847 | blobs) as well as for a whole subdirectory.</p> |
| 1848 | <p>For that reason a "tree" object is just a pure data abstraction: it |
| 1849 | has no history, no signatures, no verification of validity, except |
| 1850 | that since the contents are again protected by the hash itself, we can |
| 1851 | trust 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 |
| 1853 | can trust the contents of a blob, but you don't know where those |
| 1854 | contents <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 |
| 1857 | actually having to unpack two trees. Just ignore all common parts, |
| 1858 | and your diff will look right. In other words, you can effectively |
| 1859 | (and efficiently) tell the difference between any two random trees by |
| 1860 | O(n) where "n" is the size of the difference, rather than the size of |
| 1861 | the tree.</p> |
| 1862 | <p>Side note 2 on trees: since the name of a "blob" depends entirely and |
| 1863 | exclusively on its contents (i.e. there are no names or permissions |
| 1864 | involved), you can see trivial renames or permission changes by |
| 1865 | noticing that the blob stayed the same. However, renames with data |
| 1866 | changes 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 |
| 1868 | its data can be accessed by <a href="git-ls-tree.html">git-ls-tree(1)</a>. |
| 1869 | Two 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 |
| 1872 | history into the picture. In contrast to the other objects, it |
| 1873 | doesn't just describe the physical state of a tree, it describes how |
| 1874 | we got there, and why.</p> |
| 1875 | <p>A "commit" is defined by the tree-object that it results in, the |
| 1876 | parent commits (zero, one or more) that led up to that point, and a |
| 1877 | comment on what happened. Again, a commit is not trusted per se: |
| 1878 | the contents are well-defined and "safe" due to the cryptographically |
| 1879 | strong signatures at all levels, but there is no reason to believe |
| 1880 | that the tree is "good" or that the merge information makes sense. |
| 1881 | The parents do not have to actually have any relationship with the |
| 1882 | result, for example.</p> |
| 1883 | <p>Note on commits: unlike real SCM's, commits do not contain |
| 1884 | rename information or file mode change information. All of that is |
| 1885 | implicit in the trees involved (the result tree, and the result trees |
| 1886 | of the parents), and describing that makes no sense in this idiotic |
| 1887 | file manager.</p> |
| 1888 | <p>A commit is created with <a href="git-commit-tree.html">git-commit-tree(1)</a> and |
| 1889 | its 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 |
| 1892 | of "git", but it's worth noting a few things. First off, since |
| 1893 | everything is hashed with SHA1, you <em>can</em> trust that an object is |
| 1894 | intact and has not been messed with by external sources. So the name |
| 1895 | of an object uniquely identifies a known state - just not a state that |
| 1896 | you may want to trust.</p> |
| 1897 | <p>Furthermore, since the SHA1 signature of a commit refers to the |
| 1898 | SHA1 signatures of the tree it is associated with and the signatures |
| 1899 | of the parent, a single named commit specifies uniquely a whole set |
| 1900 | of history, with full contents. You can't later fake any step of the |
| 1901 | way 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 |
| 1903 | to do is to digitally sign just <em>one</em> special note, which includes the |
| 1904 | name of a top-level commit. Your digital signature shows others |
| 1905 | that you trust that commit, and the immutability of the history of |
| 1906 | commits tells others that they can trust the whole history.</p> |
| 1907 | <p>In other words, you can easily validate a whole archive by just |
| 1908 | sending out a single email that tells the people the name (SHA1 hash) |
| 1909 | of the top commit, and digitally sign that email using something |
| 1910 | like GPG/PGP.</p> |
| 1911 | <p>To assist in this, git also provides the tag object…</p> |
| 1912 | <h3>Tag Object</h3> |
| 1913 | <p>Git provides the "tag" object to simplify creating, managing and |
| 1914 | exchanging symbolic and signed tokens. The "tag" object at its |
| 1915 | simplest simply symbolically identifies another object by containing |
| 1916 | the 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 |
| 1919 | it). This can then be verified externally to git.</p> |
| 1920 | <p>Note that despite the tag features, "git" itself only handles content |
| 1921 | integrity; the trust framework (and signature provision and |
| 1922 | verification) has to come from outside.</p> |
| 1923 | <p>A tag is created with <a href="git-mktag.html">git-mktag(1)</a>, |
| 1924 | its data can be accessed by <a href="git-cat-file.html">git-cat-file(1)</a>, |
| 1925 | and 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 |
| 1931 | representation of a virtual directory content at some random time. It |
| 1932 | does so by a simple array that associates a set of names, dates, |
| 1933 | permissions and content (aka "blob") objects together. The cache is |
| 1934 | always kept ordered by name, and names are unique (with a few very |
| 1935 | specific rules) at any point in time, but the cache has no long-term |
| 1936 | meaning, and can be partially updated at any time.</p> |
| 1937 | <p>In particular, the index certainly does not need to be consistent with |
| 1938 | the current directory contents (in fact, most operations will depend on |
| 1939 | different ways to make the index <em>not</em> be consistent with the directory |
| 1940 | hierarchy), but it has three very important attributes:</p> |
| 1941 | <p><em>(a) it can re-generate the full state it caches (not just the |
| 1942 | directory structure: it contains pointers to the "blob" objects so |
| 1943 | that it can regenerate the data too)</em></p> |
| 1944 | <p>As a special case, there is a clear and unambiguous one-way mapping |
| 1945 | from a current directory cache to a "tree object", which can be |
| 1946 | efficiently created from just the current directory cache without |
| 1947 | actually looking at any other data. So a directory cache at any one |
| 1948 | time uniquely specifies one and only one "tree" object (but has |
| 1949 | additional data to make it easy to match up that tree object with what |
| 1950 | has happened in the directory)</p> |
| 1951 | <p><em>(b) it has efficient methods for finding inconsistencies between that |
| 1952 | cached state ("tree object waiting to be instantiated") and the |
| 1953 | current state.</em></p> |
| 1954 | <p><em>(c) it can additionally efficiently represent information about merge |
| 1955 | conflicts between different tree objects, allowing each pathname to be |
| 1956 | associated with sufficient information about the trees involved that |
| 1957 | you 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 |
| 1959 | cache, and the normal operation is to re-generate it completely from a |
| 1960 | known tree object, or update/compare it with a live tree that is being |
| 1961 | developed. If you blow the directory cache away entirely, you generally |
| 1962 | haven't lost any information as long as you have the name of the tree |
| 1963 | that it described.</p> |
| 1964 | <p>At the same time, the index is at the same time also the |
| 1965 | staging area for creating new trees, and creating a new tree always |
| 1966 | involves a controlled modification of the index file. In particular, |
| 1967 | the index file can have the representation of an intermediate tree that |
| 1968 | has not yet been instantiated. So the index can be thought of as a |
| 1969 | write-back cache, which can contain dirty information that has not yet |
| 1970 | been 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 |
| 1975 | work <strong>purely</strong> on the index file (showing the current state of the |
| 1976 | index), but most operations move data to and from the index file. Either |
| 1977 | from the database or from the working directory. Thus there are four |
| 1978 | main combinations:</p> |
| 1979 | <h3>1) working directory -> index</h3> |
| 1980 | <p>You update the index with information from the working directory with |
| 1981 | the <a href="git-update-index.html">git-update-index(1)</a> command. You |
| 1982 | generally update the index information by just specifying the filename |
| 1983 | you 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 |
| 1989 | will not normally add totally new entries or remove old entries, |
| 1990 | i.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 |
| 1992 | longer exist, or that new files should be added, you |
| 1993 | should 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 |
| 1995 | necessarily be removed: if the files still exist in your directory |
| 1996 | structure, the index will be updated with their new status, not |
| 1997 | removed. The only thing <tt>--remove</tt> means is that update-cache will be |
| 1998 | considering a removed file to be a valid thing, and if the file really |
| 1999 | does 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 |
| 2001 | will refresh the "stat" information of each index to match the current |
| 2002 | stat information. It will <em>not</em> update the object status itself, and |
| 2003 | it will only update the fields that are used to quickly test whether |
| 2004 | an object still matches its old backing store object.</p> |
| 2005 | <h3>2) index -> 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 |
| 2012 | current index into the set of tree objects that describe that state, |
| 2013 | and it will return the name of the resulting top-level tree. You can |
| 2014 | use that tree to re-generate the index at any time by going in the |
| 2015 | other direction:</p> |
| 2016 | <h3>3) object database -> index</h3> |
| 2017 | <p>You read a "tree" file from the object database, and use that to |
| 2018 | populate (and overwrite - don't do this if your index contains any |
| 2019 | unsaved state that you might want to restore later!) your current |
| 2020 | index. Normal operation is just</p> |
| 2021 | <div class="literalblock"> |
| 2022 | <div class="content"> |
| 2023 | <pre><tt>git-read-tree <sha1 of tree></tt></pre> |
| 2024 | </div></div> |
| 2025 | <p>and your index file will now be equivalent to the tree that you saved |
| 2026 | earlier. However, that is only your <em>index</em> file: your working |
| 2027 | directory contents have not been modified.</p> |
| 2028 | <h3>4) index -> working directory</h3> |
| 2029 | <p>You update your working directory from the index by "checking out" |
| 2030 | files. This is not a very common operation, since normally you'd just |
| 2031 | keep your files updated, and rather than write to your working |
| 2032 | directory, you'd tell the index files about the changes in your |
| 2033 | working 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 |
| 2035 | else's version, or just restore a previous tree, you'd populate your |
| 2036 | index file with read-tree, and then you need to check out the result |
| 2037 | with</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 |
| 2044 | if you have an old version of the tree already checked out, you will |
| 2045 | need 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 |
| 2048 | from 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 |
| 2051 | create a "commit" object that refers to that tree and the history |
| 2052 | behind it - most notably the "parent" commits that preceded it in |
| 2053 | history.</p> |
| 2054 | <p>Normally a "commit" has one parent: the previous state of the tree |
| 2055 | before a certain change was made. However, sometimes it can have two |
| 2056 | or more parent commits, in which case we call it a "merge", due to the |
| 2057 | fact that such a commit brings together ("merges") two or more |
| 2058 | previous states represented by other commits.</p> |
| 2059 | <p>In other words, while a "tree" represents a particular directory state |
| 2060 | of a working directory, a "commit" represents that state in "time", |
| 2061 | and explains how we got there.</p> |
| 2062 | <p>You create a commit object by giving it the tree that describes the |
| 2063 | state 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 <tree> -p <parent> [-p <parent2> ..]</tt></pre> |
| 2067 | </div></div> |
| 2068 | <p>and then giving the reason for the commit on stdin (either through |
| 2069 | redirection 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 |
| 2071 | that commit, and you should save it away for later use. Normally, |
| 2072 | you'd commit a new <tt>HEAD</tt> state, and while git doesn't care where you |
| 2073 | save the note about that state, in practice we tend to just write the |
| 2074 | result to the file pointed at by <tt>.git/HEAD</tt>, so that we can always see |
| 2075 | what the last committed state was.</p> |
| 2076 | <p>Here is an ASCII art by Jon Loeliger that illustrates how |
| 2077 | various 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 |
| 2116 | index 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 |
| 2118 | object:</p> |
| 2119 | <div class="literalblock"> |
| 2120 | <div class="content"> |
| 2121 | <pre><tt>git-cat-file -t <objectname></tt></pre> |
| 2122 | </div></div> |
| 2123 | <p>shows the type of the object, and once you have the type (which is |
| 2124 | usually 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 <objectname></tt></pre> |
| 2128 | </div></div> |
| 2129 | <p>to show its contents. NOTE! Trees have binary content, and as a result |
| 2130 | there is a special helper for showing that content, called |
| 2131 | <tt>git-ls-tree</tt>, which turns the binary content into a more easily |
| 2132 | readable form.</p> |
| 2133 | <p>It's especially instructive to look at "commit" objects, since those |
| 2134 | tend to be small and fairly self-explanatory. In particular, if you |
| 2135 | follow the convention of having the top commit name in <tt>.git/HEAD</tt>, |
| 2136 | you 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 |
| 2144 | repeating the merge procedure arbitrary times until you finally |
| 2145 | "commit" the state. The normal situation is that you'd only do one |
| 2146 | three-way merge (two parents), and commit it, but if you like to, you |
| 2147 | can do multiple parents in one go.</p> |
| 2148 | <p>To do a three-way merge, you need the two sets of "commit" objects |
| 2149 | that you want to merge, use those to find the closest common parent (a |
| 2150 | third "commit" object), and then use those commit objects to find the |
| 2151 | state 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 |
| 2153 | of two commits with</p> |
| 2154 | <div class="literalblock"> |
| 2155 | <div class="content"> |
| 2156 | <pre><tt>git-merge-base <commit1> <commit2></tt></pre> |
| 2157 | </div></div> |
| 2158 | <p>which will return you the commit they are both based on. You should |
| 2159 | now look up the "tree" objects of those commits, which you can easily |
| 2160 | do with (for example)</p> |
| 2161 | <div class="literalblock"> |
| 2162 | <div class="content"> |
| 2163 | <pre><tt>git-cat-file commit <commitname> | head -1</tt></pre> |
| 2164 | </div></div> |
| 2165 | <p>since the tree object information is always the first line in a commit |
| 2166 | object.</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 |
| 2169 | the branches you want to merge), you do a "merge" read into the |
| 2170 | index. This will complain if it has to throw away your old index contents, so you should |
| 2171 | make sure that you've committed those - in fact you would normally |
| 2172 | always do a merge against your last commit (which should thus match |
| 2173 | what 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 <origtree> <yourtree> <targettree></tt></pre> |
| 2178 | </div></div> |
| 2179 | <p>which will do all trivial merge operations for you directly in the |
| 2180 | index 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 |
| 2183 | section was first written, so we used to warn that |
| 2184 | the merge is done in the index file, not in your |
| 2185 | working tree, and your working tree will not match your |
| 2186 | index after this step. |
| 2187 | This is no longer true. The above command, thanks to <tt>-u</tt> |
| 2188 | option, updates your working tree with the merge results for |
| 2189 | paths 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 |
| 2192 | been added.moved or removed, or if both branches have modified the |
| 2193 | same file, you will be left with an index tree that contains "merge |
| 2194 | entries" in it. Such an index tree can <em>NOT</em> be written out to a tree |
| 2195 | object, and you will have to resolve any such merge clashes using |
| 2196 | other tools before you can write out the result.</p> |
| 2197 | <p>You can examine such index state with <tt>git-ls-files --unmerged</tt> |
| 2198 | command. 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 |
| 2203 | 100644 263414f423d0e4d70dae8fe53fa34614ff3e2860 1 hello.c |
| 2204 | 100644 06fa6a24256dc7e560efa5687fa84b51f0263c3a 2 hello.c |
| 2205 | 100644 cc44c73eb783565da5831b4d820c962954019b69 3 hello.c</tt></pre> |
| 2206 | </div></div> |
| 2207 | <p>Each line of the <tt>git-ls-files --unmerged</tt> output begins with |
| 2208 | the blob mode bits, blob SHA1, <em>stage number</em>, and the |
| 2209 | filename. The <em>stage number</em> is git's way to say which tree it |
| 2210 | came from: stage 1 corresponds to <tt>$orig</tt> tree, stage 2 <tt>HEAD</tt> |
| 2211 | tree, 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 |
| 2214 | from <tt>$orig</tt> to <tt>HEAD</tt> nor <tt>$target</tt>, or if the file changed |
| 2215 | from <tt>$orig</tt> to <tt>HEAD</tt> and <tt>$orig</tt> to <tt>$target</tt> the same way, |
| 2216 | obviously the final outcome is what is in <tt>HEAD</tt>. What the |
| 2217 | above 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. |
| 2219 | You could resolve this by running your favorite 3-way merge |
| 2220 | program, e.g. <tt>diff3</tt> or <tt>merge</tt>, on the blob objects from |
| 2221 | these three stages yourself, like this:</p> |
| 2222 | <div class="listingblock"> |
| 2223 | <div class="content"> |
| 2224 | <pre><tt>$ git-cat-file blob 263414f... >hello.c~1 |
| 2225 | $ git-cat-file blob 06fa6a2... >hello.c~2 |
| 2226 | $ git-cat-file blob cc44c73... >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 |
| 2230 | with conflict markers if there are conflicts. After verifying |
| 2231 | the merge result makes sense, you can tell git what the final |
| 2232 | merge 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 |
| 2236 | git-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 |
| 2239 | that path tells git to mark the path resolved.</p> |
| 2240 | <p>The above is the description of a git merge at the lowest level, |
| 2241 | to help you understand what conceptually happens under the hood. |
| 2242 | In practice, nobody, not even git itself, uses three <tt>git-cat-file</tt> |
| 2243 | for this. There is <tt>git-merge-index</tt> program that extracts the |
| 2244 | stages 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> |
| 2256 | git's founding father is Linus Torvalds <torvalds@osdl.org>. |
| 2257 | </p> |
| 2258 | </li> |
| 2259 | <li> |
| 2260 | <p> |
| 2261 | The current git nurse is Junio C Hamano <junkio@cox.net>. |
| 2262 | </p> |
| 2263 | </li> |
| 2264 | <li> |
| 2265 | <p> |
| 2266 | The git potty was written by Andres Ericsson <ae@op5.se>. |
| 2267 | </p> |
| 2268 | </li> |
| 2269 | <li> |
| 2270 | <p> |
| 2271 | General upbringing is handled by the git-list <git@vger.kernel.org>. |
| 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 | <david@dgreaves.com>, and later enhanced greatly by the |
| 2280 | contributors on the git-list <git@vger.kernel.org>.</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 Hamano | db450ba | 2007-01-21 08:57:14 | [diff] [blame^] | 2288 | Last updated 21-Jan-2007 08:57:05 UTC |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2289 | </div> |
| 2290 | </div> |
| 2291 | </body> |
| 2292 | </html> |