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-pull(1)</title> |
| 260 | </head> |
| 261 | <body> |
| 262 | <div id="header"> |
| 263 | <h1> |
| 264 | git-pull(1) Manual Page |
| 265 | </h1> |
| 266 | <h2>NAME</h2> |
| 267 | <div class="sectionbody"> |
| 268 | <p>git-pull - |
Junio C Hamano | 0107892 | 2006-03-10 00:31:47 | [diff] [blame] | 269 | Pull and merge from another repository |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 270 | </p> |
| 271 | </div> |
| 272 | </div> |
| 273 | <h2>SYNOPSIS</h2> |
| 274 | <div class="sectionbody"> |
| 275 | <p><em>git-pull</em> <options> <repository> <refspec>…</p> |
| 276 | </div> |
| 277 | <h2>DESCRIPTION</h2> |
| 278 | <div class="sectionbody"> |
| 279 | <p>Runs <tt>git-fetch</tt> with the given parameters, and calls <tt>git-merge</tt> |
| 280 | to merge the retrieved head(s) into the current branch.</p> |
| 281 | <p>Note that you can use <tt>.</tt> (current directory) as the |
| 282 | <repository> to pull from the local repository — this is useful |
| 283 | when merging local branches into the current branch.</p> |
| 284 | </div> |
| 285 | <h2>OPTIONS</h2> |
| 286 | <div class="sectionbody"> |
| 287 | <dl> |
| 288 | <dt> |
| 289 | -n, --no-summary |
| 290 | </dt> |
| 291 | <dd> |
| 292 | <p> |
| 293 | Do not show diffstat at the end of the merge. |
| 294 | </p> |
| 295 | </dd> |
| 296 | <dt> |
| 297 | --no-commit |
| 298 | </dt> |
| 299 | <dd> |
| 300 | <p> |
| 301 | Perform the merge but pretend the merge failed and do |
| 302 | not autocommit, to give the user a chance to inspect and |
| 303 | further tweak the merge result before committing. |
| 304 | </p> |
| 305 | </dd> |
| 306 | <dt> |
Junio C Hamano | 3901ffb | 2006-06-26 23:46:53 | [diff] [blame] | 307 | --squash |
| 308 | </dt> |
| 309 | <dd> |
| 310 | <p> |
| 311 | Produce the working tree and index state as if a real |
| 312 | merge happened, but do not actually make a commit or |
| 313 | move the <tt>HEAD</tt>, nor record <tt>$GIT_DIR/MERGE_HEAD</tt> to |
| 314 | cause the next <tt>git commit</tt> command to create a merge |
| 315 | commit. This allows you to create a single commit on |
| 316 | top of the current branch whose effect is the same as |
| 317 | merging another branch (or more in case of an octopus). |
| 318 | </p> |
| 319 | </dd> |
| 320 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 321 | -s <strategy>, --strategy=<strategy> |
| 322 | </dt> |
| 323 | <dd> |
| 324 | <p> |
| 325 | Use the given merge strategy; can be supplied more than |
| 326 | once to specify them in the order they should be tried. |
| 327 | If there is no <tt>-s</tt> option, a built-in list of strategies |
| 328 | is used instead (<tt>git-merge-recursive</tt> when merging a single |
| 329 | head, <tt>git-merge-octopus</tt> otherwise). |
| 330 | </p> |
| 331 | </dd> |
| 332 | <dt> |
| 333 | -a, --append |
| 334 | </dt> |
| 335 | <dd> |
| 336 | <p> |
| 337 | Append ref names and object names of fetched refs to the |
| 338 | existing contents of <tt>.git/FETCH_HEAD</tt>. Without this |
| 339 | option old data in <tt>.git/FETCH_HEAD</tt> will be overwritten. |
| 340 | </p> |
| 341 | </dd> |
| 342 | <dt> |
Junio C Hamano | e663a7a | 2006-01-25 12:37:28 | [diff] [blame] | 343 | --upload-pack <upload-pack> |
| 344 | </dt> |
Junio C Hamano | e663a7a | 2006-01-25 12:37:28 | [diff] [blame] | 345 | <dd> |
| 346 | <p> |
| 347 | When given, and the repository to fetch from is handled |
| 348 | by <em>git-fetch-pack</em>, <em>--exec=<upload-pack></em> is passed to |
| 349 | the command to specify non-default path for the command |
| 350 | run on the other end. |
| 351 | </p> |
| 352 | </dd> |
| 353 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 354 | -f, --force |
| 355 | </dt> |
| 356 | <dd> |
| 357 | <p> |
| 358 | When <tt>git-fetch</tt> is used with <tt><rbranch>:<lbranch></tt> |
| 359 | refspec, it refuses to update the local branch |
| 360 | <tt><lbranch></tt> unless the remote branch <tt><rbranch></tt> it |
| 361 | fetches is a descendant of <tt><lbranch></tt>. This option |
| 362 | overrides that check. |
| 363 | </p> |
| 364 | </dd> |
| 365 | <dt> |
Junio C Hamano | 4d04a40 | 2006-01-09 00:53:28 | [diff] [blame] | 366 | --no-tags |
| 367 | </dt> |
| 368 | <dd> |
| 369 | <p> |
| 370 | By default, <tt>git-fetch</tt> fetches tags that point at |
| 371 | objects that are downloaded from the remote repository |
| 372 | and stores them locally. This option disables this |
| 373 | automatic tag following. |
| 374 | </p> |
| 375 | </dd> |
| 376 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 377 | -t, --tags |
| 378 | </dt> |
| 379 | <dd> |
| 380 | <p> |
Junio C Hamano | 4d04a40 | 2006-01-09 00:53:28 | [diff] [blame] | 381 | Most of the tags are fetched automatically as branch |
| 382 | heads are downloaded, but tags that do not point at |
| 383 | objects reachable from the branch heads that are being |
| 384 | tracked will not be fetched by this mechanism. This |
| 385 | flag lets all tags and their associated objects be |
| 386 | downloaded. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 387 | </p> |
| 388 | </dd> |
| 389 | <dt> |
Junio C Hamano | b6bdc74 | 2006-01-11 11:35:32 | [diff] [blame] | 390 | -k, --keep |
| 391 | </dt> |
| 392 | <dd> |
| 393 | <p> |
| 394 | Keep downloaded pack. |
| 395 | </p> |
| 396 | </dd> |
| 397 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 398 | -u, --update-head-ok |
| 399 | </dt> |
| 400 | <dd> |
| 401 | <p> |
| 402 | By default <tt>git-fetch</tt> refuses to update the head which |
| 403 | corresponds to the current branch. This flag disables the |
| 404 | check. Note that fetching into the current branch will not |
| 405 | update the index and working directory, so use it with care. |
| 406 | </p> |
| 407 | </dd> |
| 408 | <dt> |
| 409 | <repository> |
| 410 | </dt> |
| 411 | <dd> |
| 412 | <p> |
| 413 | The "remote" repository that is the source of a fetch |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 414 | or pull operation. See the section <a href="#URLS">GIT URLS</a> below. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 415 | </p> |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 416 | </dd> |
| 417 | <dt> |
| 418 | <refspec> |
| 419 | </dt> |
| 420 | <dd> |
| 421 | <p> |
| 422 | The canonical format of a <refspec> parameter is |
| 423 | <tt>+?<src>:<dst></tt>; that is, an optional plus <tt>+</tt>, followed |
| 424 | by the source ref, followed by a colon <tt>:</tt>, followed by |
| 425 | the destination ref. |
| 426 | </p> |
| 427 | <p>The remote ref that matches <src> |
| 428 | is fetched, and if <dst> is not empty string, the local |
| 429 | ref that matches it is fast forwarded using <src>. |
| 430 | Again, if the optional plus <tt>+</tt> is used, the local ref |
| 431 | is updated even if it does not result in a fast forward |
| 432 | update.</p> |
| 433 | <div class="admonitionblock"> |
| 434 | <table><tr> |
| 435 | <td class="icon"> |
| 436 | <div class="title">Note</div> |
| 437 | </td> |
| 438 | <td class="content">If the remote branch from which you want to pull is |
| 439 | modified in non-linear ways such as being rewound and |
| 440 | rebased frequently, then a pull will attempt a merge with |
| 441 | an older version of itself, likely conflict, and fail. |
| 442 | It is under these conditions that you would want to use |
| 443 | the <tt>+</tt> sign to indicate non-fast-forward updates will |
| 444 | be needed. There is currently no easy way to determine |
| 445 | or declare that a branch will be made available in a |
| 446 | repository with this behavior; the pulling user simply |
| 447 | must know this is the expected usage pattern for a branch.</td> |
| 448 | </tr></table> |
| 449 | </div> |
| 450 | <div class="admonitionblock"> |
| 451 | <table><tr> |
| 452 | <td class="icon"> |
| 453 | <div class="title">Note</div> |
| 454 | </td> |
| 455 | <td class="content">You never do your own development on branches that appear |
| 456 | on the right hand side of a <refspec> colon on <tt>Pull:</tt> lines; |
| 457 | they are to be updated by <tt>git-fetch</tt>. If you intend to do |
| 458 | development derived from a remote branch <tt>B</tt>, have a <tt>Pull:</tt> |
| 459 | line to track it (i.e. <tt>Pull: B:remote-B</tt>), and have a separate |
| 460 | branch <tt>my-B</tt> to do your development on top of it. The latter |
| 461 | is created by <tt>git branch my-B remote-B</tt> (or its equivalent <tt>git |
| 462 | checkout -b my-B remote-B</tt>). Run <tt>git fetch</tt> to keep track of |
| 463 | the progress of the remote side, and when you see something new |
| 464 | on the remote branch, merge it into your development branch with |
| 465 | <tt>git pull . remote-B</tt>, while you are on <tt>my-B</tt> branch. |
| 466 | The common <tt>Pull: master:origin</tt> mapping of a remote <tt>master</tt> |
| 467 | branch to a local <tt>origin</tt> branch, which is then merged to a |
| 468 | local development branch, again typically named <tt>master</tt>, is made |
| 469 | when you run <tt>git clone</tt> for you to follow this pattern.</td> |
| 470 | </tr></table> |
| 471 | </div> |
| 472 | <div class="admonitionblock"> |
| 473 | <table><tr> |
| 474 | <td class="icon"> |
| 475 | <div class="title">Note</div> |
| 476 | </td> |
| 477 | <td class="content">There is a difference between listing multiple <refspec> |
| 478 | directly on <tt>git-pull</tt> command line and having multiple |
| 479 | <tt>Pull:</tt> <refspec> lines for a <repository> and running |
| 480 | <tt>git-pull</tt> command without any explicit <refspec> parameters. |
| 481 | <refspec> listed explicitly on the command line are always |
| 482 | merged into the current branch after fetching. In other words, |
| 483 | if you list more than one remote refs, you would be making |
| 484 | an Octopus. While <tt>git-pull</tt> run without any explicit <refspec> |
| 485 | parameter takes default <refspec>s from <tt>Pull:</tt> lines, it |
| 486 | merges only the first <refspec> found into the current branch, |
| 487 | after fetching all the remote refs. This is because making an |
| 488 | Octopus from remote refs is rarely done, while keeping track |
| 489 | of multiple remote heads in one-go by fetching more than one |
| 490 | is often useful.</td> |
| 491 | </tr></table> |
| 492 | </div> |
| 493 | <p>Some short-cut notations are also supported.</p> |
| 494 | <ul> |
| 495 | <li> |
| 496 | <p> |
| 497 | <tt>tag <tag></tt> means the same as <tt>refs/tags/<tag>:refs/tags/<tag></tt>; |
| 498 | it requests fetching everything up to the given tag. |
| 499 | </p> |
| 500 | </li> |
| 501 | <li> |
| 502 | <p> |
| 503 | A parameter <ref> without a colon is equivalent to |
| 504 | <ref>: when pulling/fetching, so it merges <ref> into the current |
| 505 | branch without storing the remote branch anywhere locally |
| 506 | </p> |
| 507 | </li> |
| 508 | </ul> |
| 509 | </dd> |
| 510 | </dl> |
| 511 | </div> |
| 512 | <h2>GIT URLS<a id="URLS"></a></h2> |
| 513 | <div class="sectionbody"> |
| 514 | <p>One of the following notations can be used |
| 515 | to name the remote repository:</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 516 | <div class="exampleblock"> |
| 517 | <div class="exampleblock-content"> |
| 518 | <ul> |
| 519 | <li> |
| 520 | <p> |
| 521 | rsync://host.xz/path/to/repo.git/ |
| 522 | </p> |
| 523 | </li> |
| 524 | <li> |
| 525 | <p> |
| 526 | http://host.xz/path/to/repo.git/ |
| 527 | </p> |
| 528 | </li> |
| 529 | <li> |
| 530 | <p> |
| 531 | https://host.xz/path/to/repo.git/ |
| 532 | </p> |
| 533 | </li> |
| 534 | <li> |
| 535 | <p> |
| 536 | git://host.xz/path/to/repo.git/ |
| 537 | </p> |
| 538 | </li> |
| 539 | <li> |
| 540 | <p> |
| 541 | git://host.xz/~user/path/to/repo.git/ |
| 542 | </p> |
| 543 | </li> |
| 544 | <li> |
| 545 | <p> |
Junio C Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 546 | ssh://[user@]host.xz/path/to/repo.git/ |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 547 | </p> |
| 548 | </li> |
| 549 | <li> |
| 550 | <p> |
Junio C Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 551 | ssh://[user@]host.xz/~user/path/to/repo.git/ |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 552 | </p> |
| 553 | </li> |
| 554 | <li> |
| 555 | <p> |
Junio C Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 556 | ssh://[user@]host.xz/~/path/to/repo.git |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 557 | </p> |
| 558 | </li> |
| 559 | </ul> |
| 560 | </div></div> |
Junio C Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 561 | <p>SSH is the default transport protocol. You can optionally specify |
| 562 | which user to log-in as, and an alternate, scp-like syntax is also |
| 563 | supported. Both syntaxes support username expansion, |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 564 | as does the native git protocol. The following three are |
| 565 | identical to the last three above, respectively:</p> |
| 566 | <div class="exampleblock"> |
| 567 | <div class="exampleblock-content"> |
| 568 | <ul> |
| 569 | <li> |
| 570 | <p> |
Junio C Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 571 | [user@]host.xz:/path/to/repo.git/ |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 572 | </p> |
| 573 | </li> |
| 574 | <li> |
| 575 | <p> |
Junio C Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 576 | [user@]host.xz:~user/path/to/repo.git/ |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 577 | </p> |
| 578 | </li> |
| 579 | <li> |
| 580 | <p> |
Junio C Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 581 | [user@]host.xz:path/to/repo.git |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 582 | </p> |
| 583 | </li> |
| 584 | </ul> |
| 585 | </div></div> |
| 586 | <p>To sync with a local directory, use:</p> |
| 587 | <div class="exampleblock"> |
| 588 | <div class="exampleblock-content"> |
| 589 | <ul> |
| 590 | <li> |
| 591 | <p> |
| 592 | /path/to/repo.git/ |
| 593 | </p> |
| 594 | </li> |
| 595 | </ul> |
| 596 | </div></div> |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 597 | </div> |
| 598 | <h2>REMOTES</h2> |
| 599 | <div class="sectionbody"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 600 | <p>In addition to the above, as a short-hand, the name of a |
| 601 | file in <tt>$GIT_DIR/remotes</tt> directory can be given; the |
| 602 | named file should be in the following format:</p> |
| 603 | <div class="literalblock"> |
| 604 | <div class="content"> |
| 605 | <pre><tt>URL: one of the above URL format |
| 606 | Push: <refspec> |
| 607 | Pull: <refspec></tt></pre> |
| 608 | </div></div> |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 609 | <p>Then such a short-hand is specified in place of |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 610 | <repository> without <refspec> parameters on the command |
| 611 | line, <refspec> specified on <tt>Push:</tt> lines or <tt>Pull:</tt> |
| 612 | lines are used for <tt>git-push</tt> and <tt>git-fetch</tt>/<tt>git-pull</tt>, |
Junio C Hamano | 51c2ab0 | 2006-07-09 20:38:54 | [diff] [blame] | 613 | respectively. Multiple <tt>Push:</tt> and <tt>Pull:</tt> lines may |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 614 | be specified for additional branch mappings.</p> |
| 615 | <p>The name of a file in <tt>$GIT_DIR/branches</tt> directory can be |
| 616 | specified as an older notation short-hand; the named |
| 617 | file should contain a single line, a URL in one of the |
| 618 | above formats, optionally followed by a hash <tt>#</tt> and the |
| 619 | name of remote head (URL fragment notation). |
| 620 | <tt>$GIT_DIR/branches/<remote></tt> file that stores a <url> |
| 621 | without the fragment is equivalent to have this in the |
| 622 | corresponding file in the <tt>$GIT_DIR/remotes/</tt> directory.</p> |
| 623 | <div class="literalblock"> |
| 624 | <div class="content"> |
| 625 | <pre><tt>URL: <url> |
| 626 | Pull: refs/heads/master:<remote></tt></pre> |
| 627 | </div></div> |
| 628 | <p>while having <tt><url>#<head></tt> is equivalent to</p> |
| 629 | <div class="literalblock"> |
| 630 | <div class="content"> |
| 631 | <pre><tt>URL: <url> |
| 632 | Pull: refs/heads/<head>:<remote></tt></pre> |
| 633 | </div></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 634 | </div> |
| 635 | <h2>MERGE STRATEGIES</h2> |
| 636 | <div class="sectionbody"> |
| 637 | <dl> |
| 638 | <dt> |
| 639 | resolve |
| 640 | </dt> |
| 641 | <dd> |
| 642 | <p> |
| 643 | This can only resolve two heads (i.e. the current branch |
| 644 | and another branch you pulled from) using 3-way merge |
| 645 | algorithm. It tries to carefully detect criss-cross |
| 646 | merge ambiguities and is considered generally safe and |
| 647 | fast. |
| 648 | </p> |
| 649 | </dd> |
| 650 | <dt> |
| 651 | recursive |
| 652 | </dt> |
| 653 | <dd> |
| 654 | <p> |
| 655 | This can only resolve two heads using 3-way merge |
| 656 | algorithm. When there are more than one common |
| 657 | ancestors that can be used for 3-way merge, it creates a |
| 658 | merged tree of the common ancestors and uses that as |
| 659 | the reference tree for the 3-way merge. This has been |
| 660 | reported to result in fewer merge conflicts without |
| 661 | causing mis-merges by tests done on actual merge commits |
| 662 | taken from Linux 2.6 kernel development history. |
| 663 | Additionally this can detect and handle merges involving |
| 664 | renames. This is the default merge strategy when |
| 665 | pulling or merging one branch. |
| 666 | </p> |
| 667 | </dd> |
| 668 | <dt> |
| 669 | octopus |
| 670 | </dt> |
| 671 | <dd> |
| 672 | <p> |
| 673 | This resolves more than two-head case, but refuses to do |
| 674 | complex merge that needs manual resolution. It is |
| 675 | primarily meant to be used for bundling topic branch |
| 676 | heads together. This is the default merge strategy when |
| 677 | pulling or merging more than one branches. |
| 678 | </p> |
| 679 | </dd> |
| 680 | <dt> |
| 681 | ours |
| 682 | </dt> |
| 683 | <dd> |
| 684 | <p> |
| 685 | This resolves any number of heads, but the result of the |
| 686 | merge is always the current branch head. It is meant to |
| 687 | be used to supersede old development history of side |
| 688 | branches. |
| 689 | </p> |
| 690 | </dd> |
| 691 | </dl> |
| 692 | </div> |
| 693 | <h2>EXAMPLES</h2> |
| 694 | <div class="sectionbody"> |
| 695 | <dl> |
| 696 | <dt> |
| 697 | git pull, git pull origin |
| 698 | </dt> |
| 699 | <dd> |
| 700 | <p> |
| 701 | Fetch the default head from the repository you cloned |
| 702 | from and merge it into your current branch. |
| 703 | </p> |
| 704 | </dd> |
| 705 | <dt> |
| 706 | git pull -s ours . obsolete |
| 707 | </dt> |
| 708 | <dd> |
| 709 | <p> |
| 710 | Merge local branch <tt>obsolete</tt> into the current branch, |
| 711 | using <tt>ours</tt> merge strategy. |
| 712 | </p> |
| 713 | </dd> |
| 714 | <dt> |
| 715 | git pull . fixes enhancements |
| 716 | </dt> |
| 717 | <dd> |
| 718 | <p> |
| 719 | Bundle local branch <tt>fixes</tt> and <tt>enhancements</tt> on top of |
| 720 | the current branch, making an Octopus merge. |
| 721 | </p> |
| 722 | </dd> |
| 723 | <dt> |
| 724 | git pull --no-commit . maint |
| 725 | </dt> |
| 726 | <dd> |
| 727 | <p> |
| 728 | Merge local branch <tt>maint</tt> into the current branch, but |
| 729 | do not make a commit automatically. This can be used |
| 730 | when you want to include further changes to the merge, |
| 731 | or want to write your own merge commit message. |
| 732 | </p> |
| 733 | <p>You should refrain from abusing this option to sneak substantial |
| 734 | changes into a merge commit. Small fixups like bumping |
| 735 | release/version name would be acceptable.</p> |
| 736 | </dd> |
| 737 | <dt> |
| 738 | Command line pull of multiple branches from one repository |
| 739 | </dt> |
| 740 | <dd> |
| 741 | <div class="listingblock"> |
| 742 | <div class="content"> |
| 743 | <pre><tt>$ cat .git/remotes/origin |
| 744 | URL: git://git.kernel.org/pub/scm/git/git.git |
| 745 | Pull: master:origin |
| 746 | |
| 747 | $ git checkout master |
| 748 | $ git fetch origin master:origin +pu:pu maint:maint |
| 749 | $ git pull . origin</tt></pre> |
| 750 | </div></div> |
| 751 | <p>Here, a typical <tt>.git/remotes/origin</tt> file from a |
| 752 | <tt>git-clone</tt> operation is used in combination with |
| 753 | command line options to <tt>git-fetch</tt> to first update |
| 754 | multiple branches of the local repository and then |
| 755 | to merge the remote <tt>origin</tt> branch into the local |
| 756 | <tt>master</tt> branch. The local <tt>pu</tt> branch is updated |
| 757 | even if it does not result in a fast forward update. |
| 758 | Here, the pull can obtain its objects from the local |
| 759 | repository using <tt>.</tt>, as the previous <tt>git-fetch</tt> is |
| 760 | known to have already obtained and made available |
| 761 | all the necessary objects.</p> |
| 762 | </dd> |
| 763 | <dt> |
| 764 | Pull of multiple branches from one repository using <tt>.git/remotes</tt> file |
| 765 | </dt> |
| 766 | <dd> |
| 767 | <div class="listingblock"> |
| 768 | <div class="content"> |
| 769 | <pre><tt>$ cat .git/remotes/origin |
| 770 | URL: git://git.kernel.org/pub/scm/git/git.git |
| 771 | Pull: master:origin |
| 772 | Pull: +pu:pu |
| 773 | Pull: maint:maint |
| 774 | |
| 775 | $ git checkout master |
| 776 | $ git pull origin</tt></pre> |
| 777 | </div></div> |
| 778 | <p>Here, a typical <tt>.git/remotes/origin</tt> file from a |
| 779 | <tt>git-clone</tt> operation has been hand-modified to include |
| 780 | the branch-mapping of additional remote and local |
| 781 | heads directly. A single <tt>git-pull</tt> operation while |
| 782 | in the <tt>master</tt> branch will fetch multiple heads and |
| 783 | merge the remote <tt>origin</tt> head into the current, |
| 784 | local <tt>master</tt> branch.</p> |
| 785 | </dd> |
| 786 | </dl> |
| 787 | <p>If you tried a pull which resulted in a complex conflicts and |
| 788 | would want to start over, you can recover with |
| 789 | <a href="git-reset.html">git-reset(1)</a>.</p> |
| 790 | </div> |
| 791 | <h2>SEE ALSO</h2> |
| 792 | <div class="sectionbody"> |
| 793 | <p><a href="git-fetch.html">git-fetch(1)</a>, <a href="git-merge.html">git-merge(1)</a></p> |
| 794 | </div> |
| 795 | <h2>Author</h2> |
| 796 | <div class="sectionbody"> |
| 797 | <p>Written by Linus Torvalds <torvalds@osdl.org> |
| 798 | and Junio C Hamano <junkio@cox.net></p> |
| 799 | </div> |
| 800 | <h2>Documentation</h2> |
| 801 | <div class="sectionbody"> |
| 802 | <p>Documentation by Jon Loeliger, |
| 803 | David Greaves, |
| 804 | Junio C Hamano and the git-list <git@vger.kernel.org>.</p> |
| 805 | </div> |
| 806 | <h2>GIT</h2> |
| 807 | <div class="sectionbody"> |
| 808 | <p>Part of the <a href="git.html">git(7)</a> suite</p> |
| 809 | </div> |
| 810 | <div id="footer"> |
| 811 | <div id="footer-text"> |
Junio C Hamano | d97409f | 2006-10-03 08:41:56 | [diff] [blame] | 812 | Last updated 03-Oct-2006 08:41:18 UTC |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 813 | </div> |
| 814 | </div> |
| 815 | </body> |
| 816 | </html> |