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 | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 6 | <meta name="generator" content="AsciiDoc 8.2.5" /> |
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 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 19 | a { |
| 20 | color: blue; |
| 21 | text-decoration: underline; |
| 22 | } |
| 23 | a:visited { |
| 24 | color: fuchsia; |
| 25 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 26 | |
| 27 | em { |
| 28 | font-style: italic; |
| 29 | } |
| 30 | |
| 31 | strong { |
| 32 | font-weight: bold; |
| 33 | } |
| 34 | |
| 35 | tt { |
| 36 | color: navy; |
| 37 | } |
| 38 | |
| 39 | h1, h2, h3, h4, h5, h6 { |
| 40 | color: #527bbd; |
| 41 | font-family: sans-serif; |
| 42 | margin-top: 1.2em; |
| 43 | margin-bottom: 0.5em; |
| 44 | line-height: 1.3; |
| 45 | } |
| 46 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 47 | h1, h2, h3 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 48 | border-bottom: 2px solid silver; |
| 49 | } |
| 50 | h2 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 51 | padding-top: 0.5em; |
| 52 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 53 | h3 { |
| 54 | float: left; |
| 55 | } |
| 56 | h3 + * { |
| 57 | clear: left; |
| 58 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 59 | |
| 60 | div.sectionbody { |
| 61 | font-family: serif; |
| 62 | margin-left: 0; |
| 63 | } |
| 64 | |
| 65 | hr { |
| 66 | border: 1px solid silver; |
| 67 | } |
| 68 | |
| 69 | p { |
| 70 | margin-top: 0.5em; |
| 71 | margin-bottom: 0.5em; |
| 72 | } |
| 73 | |
| 74 | pre { |
| 75 | padding: 0; |
| 76 | margin: 0; |
| 77 | } |
| 78 | |
| 79 | span#author { |
| 80 | color: #527bbd; |
| 81 | font-family: sans-serif; |
| 82 | font-weight: bold; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 83 | font-size: 1.1em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 84 | } |
| 85 | span#email { |
| 86 | } |
| 87 | span#revision { |
| 88 | font-family: sans-serif; |
| 89 | } |
| 90 | |
| 91 | div#footer { |
| 92 | font-family: sans-serif; |
| 93 | font-size: small; |
| 94 | border-top: 2px solid silver; |
| 95 | padding-top: 0.5em; |
| 96 | margin-top: 4.0em; |
| 97 | } |
| 98 | div#footer-text { |
| 99 | float: left; |
| 100 | padding-bottom: 0.5em; |
| 101 | } |
| 102 | div#footer-badges { |
| 103 | float: right; |
| 104 | padding-bottom: 0.5em; |
| 105 | } |
| 106 | |
| 107 | div#preamble, |
| 108 | div.tableblock, div.imageblock, div.exampleblock, div.verseblock, |
| 109 | div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, |
| 110 | div.admonitionblock { |
| 111 | margin-right: 10%; |
| 112 | margin-top: 1.5em; |
| 113 | margin-bottom: 1.5em; |
| 114 | } |
| 115 | div.admonitionblock { |
| 116 | margin-top: 2.5em; |
| 117 | margin-bottom: 2.5em; |
| 118 | } |
| 119 | |
| 120 | div.content { /* Block element content. */ |
| 121 | padding: 0; |
| 122 | } |
| 123 | |
| 124 | /* Block element titles. */ |
| 125 | div.title, caption.title { |
| 126 | font-family: sans-serif; |
| 127 | font-weight: bold; |
| 128 | text-align: left; |
| 129 | margin-top: 1.0em; |
| 130 | margin-bottom: 0.5em; |
| 131 | } |
| 132 | div.title + * { |
| 133 | margin-top: 0; |
| 134 | } |
| 135 | |
| 136 | td div.title:first-child { |
| 137 | margin-top: 0.0em; |
| 138 | } |
| 139 | div.content div.title:first-child { |
| 140 | margin-top: 0.0em; |
| 141 | } |
| 142 | div.content + div.title { |
| 143 | margin-top: 0.0em; |
| 144 | } |
| 145 | |
| 146 | div.sidebarblock > div.content { |
| 147 | background: #ffffee; |
| 148 | border: 1px solid silver; |
| 149 | padding: 0.5em; |
| 150 | } |
| 151 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 152 | div.listingblock { |
| 153 | margin-right: 0%; |
| 154 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 155 | div.listingblock > div.content { |
| 156 | border: 1px solid silver; |
| 157 | background: #f4f4f4; |
| 158 | padding: 0.5em; |
| 159 | } |
| 160 | |
| 161 | div.quoteblock > div.content { |
| 162 | padding-left: 2.0em; |
| 163 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 164 | |
| 165 | div.attribution { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 166 | text-align: right; |
| 167 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 168 | div.verseblock + div.attribution { |
| 169 | text-align: left; |
| 170 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 171 | |
| 172 | div.admonitionblock .icon { |
| 173 | vertical-align: top; |
| 174 | font-size: 1.1em; |
| 175 | font-weight: bold; |
| 176 | text-decoration: underline; |
| 177 | color: #527bbd; |
| 178 | padding-right: 0.5em; |
| 179 | } |
| 180 | div.admonitionblock td.content { |
| 181 | padding-left: 0.5em; |
| 182 | border-left: 2px solid silver; |
| 183 | } |
| 184 | |
| 185 | div.exampleblock > div.content { |
| 186 | border-left: 2px solid silver; |
| 187 | padding: 0.5em; |
| 188 | } |
| 189 | |
| 190 | div.verseblock div.content { |
| 191 | white-space: pre; |
| 192 | } |
| 193 | |
| 194 | div.imageblock div.content { padding-left: 0; } |
| 195 | div.imageblock img { border: 1px solid silver; } |
| 196 | span.image img { border-style: none; } |
| 197 | |
| 198 | dl { |
| 199 | margin-top: 0.8em; |
| 200 | margin-bottom: 0.8em; |
| 201 | } |
| 202 | dt { |
| 203 | margin-top: 0.5em; |
| 204 | margin-bottom: 0; |
| 205 | font-style: italic; |
| 206 | } |
| 207 | dd > *:first-child { |
| 208 | margin-top: 0; |
| 209 | } |
| 210 | |
| 211 | ul, ol { |
| 212 | list-style-position: outside; |
| 213 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 214 | div.olist2 ol { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 215 | list-style-type: lower-alpha; |
| 216 | } |
| 217 | |
| 218 | div.tableblock > table { |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 219 | border: 3px solid #527bbd; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 220 | } |
| 221 | thead { |
| 222 | font-family: sans-serif; |
| 223 | font-weight: bold; |
| 224 | } |
| 225 | tfoot { |
| 226 | font-weight: bold; |
| 227 | } |
| 228 | |
| 229 | div.hlist { |
| 230 | margin-top: 0.8em; |
| 231 | margin-bottom: 0.8em; |
| 232 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 233 | div.hlist td { |
| 234 | padding-bottom: 5px; |
| 235 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 236 | td.hlist1 { |
| 237 | vertical-align: top; |
| 238 | font-style: italic; |
| 239 | padding-right: 0.8em; |
| 240 | } |
| 241 | td.hlist2 { |
| 242 | vertical-align: top; |
| 243 | } |
| 244 | |
| 245 | @media print { |
| 246 | div#footer-badges { display: none; } |
| 247 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 248 | |
| 249 | div#toctitle { |
| 250 | color: #527bbd; |
| 251 | font-family: sans-serif; |
| 252 | font-size: 1.1em; |
| 253 | font-weight: bold; |
| 254 | margin-top: 1.0em; |
| 255 | margin-bottom: 0.1em; |
| 256 | } |
| 257 | |
| 258 | div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { |
| 259 | margin-top: 0; |
| 260 | margin-bottom: 0; |
| 261 | } |
| 262 | div.toclevel2 { |
| 263 | margin-left: 2em; |
| 264 | font-size: 0.9em; |
| 265 | } |
| 266 | div.toclevel3 { |
| 267 | margin-left: 4em; |
| 268 | font-size: 0.9em; |
| 269 | } |
| 270 | div.toclevel4 { |
| 271 | margin-left: 6em; |
| 272 | font-size: 0.9em; |
| 273 | } |
| 274 | include1::./stylesheets/xhtml11-manpage.css[] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 275 | /* Workarounds for IE6's broken and incomplete CSS2. */ |
| 276 | |
| 277 | div.sidebar-content { |
| 278 | background: #ffffee; |
| 279 | border: 1px solid silver; |
| 280 | padding: 0.5em; |
| 281 | } |
| 282 | div.sidebar-title, div.image-title { |
| 283 | font-family: sans-serif; |
| 284 | font-weight: bold; |
| 285 | margin-top: 0.0em; |
| 286 | margin-bottom: 0.5em; |
| 287 | } |
| 288 | |
| 289 | div.listingblock div.content { |
| 290 | border: 1px solid silver; |
| 291 | background: #f4f4f4; |
| 292 | padding: 0.5em; |
| 293 | } |
| 294 | |
| 295 | div.quoteblock-content { |
| 296 | padding-left: 2.0em; |
| 297 | } |
| 298 | |
| 299 | div.exampleblock-content { |
| 300 | border-left: 2px solid silver; |
| 301 | padding-left: 0.5em; |
| 302 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 303 | |
| 304 | /* IE6 sets dynamically generated links as visited. */ |
| 305 | div#toc a:visited { color: blue; } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 306 | </style> |
| 307 | <title>git-merge(1)</title> |
| 308 | </head> |
| 309 | <body> |
| 310 | <div id="header"> |
| 311 | <h1> |
| 312 | git-merge(1) Manual Page |
| 313 | </h1> |
| 314 | <h2>NAME</h2> |
| 315 | <div class="sectionbody"> |
| 316 | <p>git-merge - |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 317 | Join two or more development histories together |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 318 | </p> |
| 319 | </div> |
| 320 | </div> |
| 321 | <h2>SYNOPSIS</h2> |
| 322 | <div class="sectionbody"> |
Junio C Hamano | ee6d961 | 2006-11-27 20:03:22 | [diff] [blame] | 323 | <div class="verseblock"> |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 324 | <div class="content"><em>git merge</em> [-n] [--stat] [--no-commit] [--squash] [-s <strategy>]… |
Junio C Hamano | 27a128b | 2009-08-13 01:23:00 | [diff] [blame] | 325 | [-m <msg>] <remote>… |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 326 | <em>git merge</em> <msg> HEAD <remote>…</div></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 327 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 328 | <h2 id="_description">DESCRIPTION</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 329 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 330 | <div class="para"><p>This is the top-level interface to the merge machinery |
| 331 | which drives multiple merge strategy scripts.</p></div> |
| 332 | <div class="para"><p>The second syntax (<msg> <tt>HEAD</tt> <remote>) is supported for |
Junio C Hamano | 1974bf2 | 2007-10-31 05:57:20 | [diff] [blame] | 333 | historical reasons. Do not use it from the command line or in |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 334 | new scripts. It is the same as <tt>git merge -m <msg> <remote></tt>.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 335 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 336 | <h2 id="_options">OPTIONS</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 337 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 338 | <div class="vlist"><dl> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 339 | <dt> |
Junio C Hamano | c21ab05 | 2009-10-31 04:03:55 | [diff] [blame] | 340 | --commit |
| 341 | </dt> |
| 342 | <dt> |
| 343 | --no-commit |
| 344 | </dt> |
| 345 | <dd> |
| 346 | <p> |
| 347 | Perform the merge and commit the result. This option can |
| 348 | be used to override --no-commit. |
| 349 | </p> |
| 350 | <div class="para"><p>With --no-commit perform the merge but pretend the merge |
| 351 | failed and do not autocommit, to give the user a chance to |
| 352 | inspect and further tweak the merge result before committing.</p></div> |
| 353 | </dd> |
| 354 | <dt> |
| 355 | --ff |
| 356 | </dt> |
| 357 | <dt> |
| 358 | --no-ff |
| 359 | </dt> |
| 360 | <dd> |
| 361 | <p> |
| 362 | Do not generate a merge commit if the merge resolved as |
| 363 | a fast-forward, only update the branch pointer. This is |
| 364 | the default behavior of git-merge. |
| 365 | </p> |
| 366 | <div class="para"><p>With --no-ff Generate a merge commit even if the merge |
| 367 | resolved as a fast-forward.</p></div> |
| 368 | </dd> |
| 369 | <dt> |
| 370 | --log |
| 371 | </dt> |
| 372 | <dt> |
| 373 | --no-log |
| 374 | </dt> |
| 375 | <dd> |
| 376 | <p> |
| 377 | In addition to branch names, populate the log message with |
| 378 | one-line descriptions from the actual commits that are being |
| 379 | merged. |
| 380 | </p> |
| 381 | <div class="para"><p>With --no-log do not list one-line descriptions from the |
| 382 | actual commits being merged.</p></div> |
| 383 | </dd> |
| 384 | <dt> |
| 385 | --stat |
| 386 | </dt> |
| 387 | <dt> |
| 388 | -n |
| 389 | </dt> |
| 390 | <dt> |
| 391 | --no-stat |
| 392 | </dt> |
| 393 | <dd> |
| 394 | <p> |
| 395 | Show a diffstat at the end of the merge. The diffstat is also |
| 396 | controlled by the configuration option merge.stat. |
| 397 | </p> |
| 398 | <div class="para"><p>With -n or --no-stat do not show a diffstat at the end of the |
| 399 | merge.</p></div> |
| 400 | </dd> |
| 401 | <dt> |
| 402 | --squash |
| 403 | </dt> |
| 404 | <dt> |
| 405 | --no-squash |
| 406 | </dt> |
| 407 | <dd> |
| 408 | <p> |
| 409 | Produce the working tree and index state as if a real |
| 410 | merge happened (except for the merge information), |
| 411 | but do not actually make a commit or |
| 412 | move the <tt>HEAD</tt>, nor record <tt>$GIT_DIR/MERGE_HEAD</tt> to |
| 413 | cause the next <tt>git commit</tt> command to create a merge |
| 414 | commit. This allows you to create a single commit on |
| 415 | top of the current branch whose effect is the same as |
| 416 | merging another branch (or more in case of an octopus). |
| 417 | </p> |
| 418 | <div class="para"><p>With --no-squash perform the merge and commit the result. This |
| 419 | option can be used to override --squash.</p></div> |
| 420 | </dd> |
| 421 | <dt> |
Junio C Hamano | 446ed77 | 2009-11-10 22:02:20 | [diff] [blame] | 422 | --ff-only |
| 423 | </dt> |
| 424 | <dd> |
| 425 | <p> |
| 426 | Refuse to merge and exit with a non-zero status unless the |
| 427 | current <tt>HEAD</tt> is already up-to-date or the merge can be |
| 428 | resolved as a fast-forward. |
| 429 | </p> |
| 430 | </dd> |
| 431 | <dt> |
Junio C Hamano | c21ab05 | 2009-10-31 04:03:55 | [diff] [blame] | 432 | -s <strategy> |
| 433 | </dt> |
| 434 | <dt> |
| 435 | --strategy=<strategy> |
| 436 | </dt> |
| 437 | <dd> |
| 438 | <p> |
| 439 | Use the given merge strategy; can be supplied more than |
| 440 | once to specify them in the order they should be tried. |
| 441 | If there is no <tt>-s</tt> option, a built-in list of strategies |
| 442 | is used instead (<em>git-merge-recursive</em> when merging a single |
| 443 | head, <em>git-merge-octopus</em> otherwise). |
| 444 | </p> |
| 445 | </dd> |
| 446 | <dt> |
| 447 | --summary |
| 448 | </dt> |
| 449 | <dt> |
| 450 | --no-summary |
| 451 | </dt> |
| 452 | <dd> |
| 453 | <p> |
| 454 | Synonyms to --stat and --no-stat; these are deprecated and will be |
| 455 | removed in the future. |
| 456 | </p> |
| 457 | </dd> |
| 458 | <dt> |
Junio C Hamano | 610d176 | 2008-11-28 06:27:13 | [diff] [blame] | 459 | -q |
| 460 | </dt> |
| 461 | <dt> |
| 462 | --quiet |
| 463 | </dt> |
| 464 | <dd> |
| 465 | <p> |
| 466 | Operate quietly. |
| 467 | </p> |
| 468 | </dd> |
| 469 | <dt> |
| 470 | -v |
| 471 | </dt> |
| 472 | <dt> |
| 473 | --verbose |
| 474 | </dt> |
| 475 | <dd> |
| 476 | <p> |
| 477 | Be verbose. |
| 478 | </p> |
| 479 | </dd> |
| 480 | <dt> |
Junio C Hamano | 1974bf2 | 2007-10-31 05:57:20 | [diff] [blame] | 481 | -m <msg> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 482 | </dt> |
| 483 | <dd> |
| 484 | <p> |
Junio C Hamano | c0e55e7 | 2009-10-10 00:56:29 | [diff] [blame] | 485 | Set the commit message to be used for the merge commit (in |
| 486 | case one is created). The <em>git fmt-merge-msg</em> command can be |
| 487 | used to give a good default for automated <em>git merge</em> |
| 488 | invocations. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 489 | </p> |
| 490 | </dd> |
| 491 | <dt> |
Junio C Hamano | 9e39507 | 2008-07-31 22:11:21 | [diff] [blame] | 492 | <remote>… |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 493 | </dt> |
| 494 | <dd> |
| 495 | <p> |
Junio C Hamano | 9e39507 | 2008-07-31 22:11:21 | [diff] [blame] | 496 | Other branch heads to merge into our branch. You need at |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 497 | least one <remote>. Specifying more than one <remote> |
| 498 | obviously means you are trying an Octopus. |
| 499 | </p> |
| 500 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 501 | </dl></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 502 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 503 | <h2 id="_merge_strategies">MERGE STRATEGIES</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 504 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 505 | <div class="vlist"><dl> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 506 | <dt> |
| 507 | resolve |
| 508 | </dt> |
| 509 | <dd> |
| 510 | <p> |
| 511 | This can only resolve two heads (i.e. the current branch |
Junio C Hamano | 1de7572 | 2009-03-26 08:39:38 | [diff] [blame] | 512 | and another branch you pulled from) using a 3-way merge |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 513 | algorithm. It tries to carefully detect criss-cross |
| 514 | merge ambiguities and is considered generally safe and |
| 515 | fast. |
| 516 | </p> |
| 517 | </dd> |
| 518 | <dt> |
| 519 | recursive |
| 520 | </dt> |
| 521 | <dd> |
| 522 | <p> |
Junio C Hamano | 1de7572 | 2009-03-26 08:39:38 | [diff] [blame] | 523 | This can only resolve two heads using a 3-way merge |
| 524 | algorithm. When there is more than one common |
| 525 | ancestor that can be used for 3-way merge, it creates a |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 526 | merged tree of the common ancestors and uses that as |
| 527 | the reference tree for the 3-way merge. This has been |
| 528 | reported to result in fewer merge conflicts without |
| 529 | causing mis-merges by tests done on actual merge commits |
| 530 | taken from Linux 2.6 kernel development history. |
| 531 | Additionally this can detect and handle merges involving |
| 532 | renames. This is the default merge strategy when |
| 533 | pulling or merging one branch. |
| 534 | </p> |
| 535 | </dd> |
| 536 | <dt> |
| 537 | octopus |
| 538 | </dt> |
| 539 | <dd> |
| 540 | <p> |
Junio C Hamano | 1de7572 | 2009-03-26 08:39:38 | [diff] [blame] | 541 | This resolves cases with more than two heads, but refuses to do |
| 542 | a complex merge that needs manual resolution. It is |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 543 | primarily meant to be used for bundling topic branch |
| 544 | heads together. This is the default merge strategy when |
Junio C Hamano | 1de7572 | 2009-03-26 08:39:38 | [diff] [blame] | 545 | pulling or merging more than one branch. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 546 | </p> |
| 547 | </dd> |
| 548 | <dt> |
| 549 | ours |
| 550 | </dt> |
| 551 | <dd> |
| 552 | <p> |
| 553 | This resolves any number of heads, but the result of the |
| 554 | merge is always the current branch head. It is meant to |
| 555 | be used to supersede old development history of side |
| 556 | branches. |
| 557 | </p> |
| 558 | </dd> |
Junio C Hamano | e6c9203 | 2008-03-19 09:24:34 | [diff] [blame] | 559 | <dt> |
| 560 | subtree |
| 561 | </dt> |
| 562 | <dd> |
| 563 | <p> |
| 564 | This is a modified recursive strategy. When merging trees A and |
| 565 | B, if B corresponds to a subtree of A, B is first adjusted to |
| 566 | match the tree structure of A, instead of reading the trees at |
| 567 | the same level. This adjustment is also done to the common |
| 568 | ancestor tree. |
| 569 | </p> |
| 570 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 571 | </dl></div> |
Junio C Hamano | 36a5672 | 2009-03-28 08:55:34 | [diff] [blame] | 572 | <div class="para"><p>If you tried a merge which resulted in complex conflicts and |
Junio C Hamano | 1de7572 | 2009-03-26 08:39:38 | [diff] [blame] | 573 | want to start over, you can recover with <em>git-reset</em>.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 574 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 575 | <h2 id="_configuration">CONFIGURATION</h2> |
Junio C Hamano | 1e6e006 | 2007-07-13 05:33:25 | [diff] [blame] | 576 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 577 | <div class="vlist"><dl> |
Junio C Hamano | 1e6e006 | 2007-07-13 05:33:25 | [diff] [blame] | 578 | <dt> |
Junio C Hamano | 4653c6f | 2008-11-26 22:50:20 | [diff] [blame] | 579 | merge.conflictstyle |
Junio C Hamano | 1e6e006 | 2007-07-13 05:33:25 | [diff] [blame] | 580 | </dt> |
| 581 | <dd> |
| 582 | <p> |
Junio C Hamano | 4653c6f | 2008-11-26 22:50:20 | [diff] [blame] | 583 | Specify the style in which conflicted hunks are written out to |
| 584 | working tree files upon merge. The default is "merge", which |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 585 | shows a <tt><<<<<<<</tt> conflict marker, changes made by one side, |
| 586 | a <tt>=======</tt> marker, changes made by the other side, and then |
| 587 | a <tt>>>>>>>></tt> marker. An alternate style, "diff3", adds a <tt>|||||||</tt> |
| 588 | marker and the original text before the <tt>=======</tt> marker. |
Junio C Hamano | 6d76d61 | 2008-05-09 05:46:08 | [diff] [blame] | 589 | </p> |
| 590 | </dd> |
| 591 | <dt> |
| 592 | merge.log |
| 593 | </dt> |
| 594 | <dd> |
| 595 | <p> |
| 596 | Whether to include summaries of merged commits in newly created |
| 597 | merge commit messages. False by default. |
| 598 | </p> |
| 599 | </dd> |
| 600 | <dt> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 601 | merge.renameLimit |
| 602 | </dt> |
| 603 | <dd> |
| 604 | <p> |
| 605 | The number of files to consider when performing rename detection |
| 606 | during a merge; if not specified, defaults to the value of |
| 607 | diff.renameLimit. |
| 608 | </p> |
| 609 | </dd> |
| 610 | <dt> |
Junio C Hamano | 4653c6f | 2008-11-26 22:50:20 | [diff] [blame] | 611 | merge.stat |
| 612 | </dt> |
| 613 | <dd> |
| 614 | <p> |
| 615 | Whether to print the diffstat between ORIG_HEAD and the merge result |
| 616 | at the end of the merge. True by default. |
| 617 | </p> |
| 618 | </dd> |
| 619 | <dt> |
Junio C Hamano | 6d76d61 | 2008-05-09 05:46:08 | [diff] [blame] | 620 | merge.tool |
| 621 | </dt> |
| 622 | <dd> |
| 623 | <p> |
| 624 | Controls which merge resolution program is used by |
| 625 | <a href="git-mergetool.html">git-mergetool(1)</a>. Valid built-in values are: "kdiff3", |
Junio C Hamano | 3bd66e9 | 2009-04-18 06:17:56 | [diff] [blame] | 626 | "tkdiff", "meld", "xxdiff", "emerge", "vimdiff", "gvimdiff", |
Junio C Hamano | 3f680f3 | 2009-11-16 02:10:54 | [diff] [blame^] | 627 | "diffuse", "ecmerge", "tortoisemerge", "p4merge", "araxis" and |
Junio C Hamano | 6d76d61 | 2008-05-09 05:46:08 | [diff] [blame] | 628 | "opendiff". Any other value is treated is custom merge tool |
Junio C Hamano | cb1c44f | 2008-08-06 06:19:33 | [diff] [blame] | 629 | and there must be a corresponding mergetool.<tool>.cmd option. |
Junio C Hamano | 1e6e006 | 2007-07-13 05:33:25 | [diff] [blame] | 630 | </p> |
| 631 | </dd> |
| 632 | <dt> |
| 633 | merge.verbosity |
| 634 | </dt> |
| 635 | <dd> |
| 636 | <p> |
| 637 | Controls the amount of output shown by the recursive merge |
| 638 | strategy. Level 0 outputs nothing except a final error |
| 639 | message if conflicts were detected. Level 1 outputs only |
| 640 | conflicts, 2 outputs conflicts and file changes. Level 5 and |
| 641 | above outputs debugging information. The default is level 2. |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 642 | Can be overridden by the <em>GIT_MERGE_VERBOSITY</em> environment variable. |
Junio C Hamano | 1e6e006 | 2007-07-13 05:33:25 | [diff] [blame] | 643 | </p> |
| 644 | </dd> |
Junio C Hamano | 1b50ce9 | 2007-10-03 12:05:53 | [diff] [blame] | 645 | <dt> |
Junio C Hamano | 6d76d61 | 2008-05-09 05:46:08 | [diff] [blame] | 646 | merge.<driver>.name |
| 647 | </dt> |
| 648 | <dd> |
| 649 | <p> |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 650 | Defines a human-readable name for a custom low-level |
Junio C Hamano | 6d76d61 | 2008-05-09 05:46:08 | [diff] [blame] | 651 | merge driver. See <a href="gitattributes.html">gitattributes(5)</a> for details. |
| 652 | </p> |
| 653 | </dd> |
| 654 | <dt> |
| 655 | merge.<driver>.driver |
| 656 | </dt> |
| 657 | <dd> |
| 658 | <p> |
| 659 | Defines the command that implements a custom low-level |
| 660 | merge driver. See <a href="gitattributes.html">gitattributes(5)</a> for details. |
| 661 | </p> |
| 662 | </dd> |
| 663 | <dt> |
| 664 | merge.<driver>.recursive |
| 665 | </dt> |
| 666 | <dd> |
| 667 | <p> |
| 668 | Names a low-level merge driver to be used when |
| 669 | performing an internal merge between common ancestors. |
| 670 | See <a href="gitattributes.html">gitattributes(5)</a> for details. |
| 671 | </p> |
| 672 | </dd> |
| 673 | <dt> |
Junio C Hamano | 1b50ce9 | 2007-10-03 12:05:53 | [diff] [blame] | 674 | branch.<name>.mergeoptions |
| 675 | </dt> |
| 676 | <dd> |
| 677 | <p> |
| 678 | Sets default options for merging into branch <name>. The syntax and |
Junio C Hamano | c0e55e7 | 2009-10-10 00:56:29 | [diff] [blame] | 679 | supported options are the same as those of <em>git merge</em>, but option |
| 680 | values containing whitespace characters are currently not supported. |
Junio C Hamano | 1b50ce9 | 2007-10-03 12:05:53 | [diff] [blame] | 681 | </p> |
| 682 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 683 | </dl></div> |
Junio C Hamano | 1e6e006 | 2007-07-13 05:33:25 | [diff] [blame] | 684 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 685 | <h2 id="_how_merge_works">HOW MERGE WORKS</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 686 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 687 | <div class="para"><p>A merge is always between the current <tt>HEAD</tt> and one or more |
Junio C Hamano | 3b022a5 | 2008-03-04 12:06:24 | [diff] [blame] | 688 | commits (usually, branch head or tag), and the index file must |
Junio C Hamano | 915cd9b | 2008-07-20 01:24:17 | [diff] [blame] | 689 | match the tree of <tt>HEAD</tt> commit (i.e. the contents of the last commit) |
| 690 | when it starts out. In other words, <tt>git diff --cached HEAD</tt> must |
| 691 | report no changes. (One exception is when the changed index |
| 692 | entries are already in the same state that would result from |
| 693 | the merge anyway.)</p></div> |
| 694 | <div class="para"><p>Three kinds of merge can happen:</p></div> |
| 695 | <div class="ilist"><ul> |
| 696 | <li> |
| 697 | <p> |
| 698 | The merged commit is already contained in <tt>HEAD</tt>. This is the |
| 699 | simplest case, called "Already up-to-date." |
| 700 | </p> |
| 701 | </li> |
| 702 | <li> |
| 703 | <p> |
| 704 | <tt>HEAD</tt> is already contained in the merged commit. This is the |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 705 | most common case especially when invoked from <em>git pull</em>: |
| 706 | you are tracking an upstream repository, have committed no local |
Junio C Hamano | 915cd9b | 2008-07-20 01:24:17 | [diff] [blame] | 707 | changes and now you want to update to a newer upstream revision. |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 708 | Your <tt>HEAD</tt> (and the index) is updated to point at the merged |
Junio C Hamano | 915cd9b | 2008-07-20 01:24:17 | [diff] [blame] | 709 | commit, without creating an extra merge commit. This is |
| 710 | called "Fast-forward". |
| 711 | </p> |
| 712 | </li> |
| 713 | <li> |
| 714 | <p> |
| 715 | Both the merged commit and <tt>HEAD</tt> are independent and must be |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 716 | tied together by a merge commit that has both of them as its parents. |
Junio C Hamano | 915cd9b | 2008-07-20 01:24:17 | [diff] [blame] | 717 | The rest of this section describes this "True merge" case. |
| 718 | </p> |
| 719 | </li> |
| 720 | </ul></div> |
| 721 | <div class="para"><p>The chosen merge strategy merges the two commits into a single |
| 722 | new source tree. |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 723 | When things merge cleanly, this is what happens:</p></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 724 | <div class="olist"><ol> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 725 | <li> |
| 726 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 727 | The results are updated both in the index file and in your |
| 728 | working tree; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 729 | </p> |
| 730 | </li> |
| 731 | <li> |
| 732 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 733 | Index file is written out as a tree; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 734 | </p> |
| 735 | </li> |
| 736 | <li> |
| 737 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 738 | The tree gets committed; and |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 739 | </p> |
| 740 | </li> |
| 741 | <li> |
| 742 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 743 | The <tt>HEAD</tt> pointer gets advanced. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 744 | </p> |
| 745 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 746 | </ol></div> |
| 747 | <div class="para"><p>Because of 2., we require that the original state of the index |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 748 | file matches exactly the current <tt>HEAD</tt> commit; otherwise we |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 749 | will write out your local changes already registered in your |
| 750 | index file along with the merge result, which is not good. |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 751 | Because 1. involves only those paths differing between your |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 752 | branch and the remote branch you are pulling from during the |
| 753 | merge (which is typically a fraction of the whole tree), you can |
| 754 | have local modifications in your working tree as long as they do |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 755 | not overlap with what the merge updates.</p></div> |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 756 | <div class="para"><p>When there are conflicts, the following happens:</p></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 757 | <div class="olist"><ol> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 758 | <li> |
| 759 | <p> |
| 760 | <tt>HEAD</tt> stays the same. |
| 761 | </p> |
| 762 | </li> |
| 763 | <li> |
| 764 | <p> |
| 765 | Cleanly merged paths are updated both in the index file and |
| 766 | in your working tree. |
| 767 | </p> |
| 768 | </li> |
| 769 | <li> |
| 770 | <p> |
| 771 | For conflicting paths, the index file records up to three |
| 772 | versions; stage1 stores the version from the common ancestor, |
| 773 | stage2 from <tt>HEAD</tt>, and stage3 from the remote branch (you |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 774 | can inspect the stages with <tt>git ls-files -u</tt>). The working |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 775 | tree files contain the result of the "merge" program; i.e. 3-way |
| 776 | merge results with familiar conflict markers <tt><<< === >>></tt>. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 777 | </p> |
| 778 | </li> |
| 779 | <li> |
| 780 | <p> |
| 781 | No other changes are done. In particular, the local |
| 782 | modifications you had before you started merge will stay the |
| 783 | same and the index entries for them stay as they were, |
| 784 | i.e. matching <tt>HEAD</tt>. |
| 785 | </p> |
| 786 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 787 | </ol></div> |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 788 | </div> |
| 789 | <h2 id="_how_conflicts_are_presented">HOW CONFLICTS ARE PRESENTED</h2> |
| 790 | <div class="sectionbody"> |
| 791 | <div class="para"><p>During a merge, the working tree files are updated to reflect the result |
| 792 | of the merge. Among the changes made to the common ancestor's version, |
| 793 | non-overlapping ones (that is, you changed an area of the file while the |
| 794 | other side left that area intact, or vice versa) are incorporated in the |
| 795 | final result verbatim. When both sides made changes to the same area, |
| 796 | however, git cannot randomly pick one side over the other, and asks you to |
| 797 | resolve it by leaving what both sides did to that area.</p></div> |
| 798 | <div class="para"><p>By default, git uses the same style as that is used by "merge" program |
| 799 | from the RCS suite to present such a conflicted hunk, like this:</p></div> |
| 800 | <div class="listingblock"> |
| 801 | <div class="content"> |
| 802 | <pre><tt>Here are lines that are either unchanged from the common |
| 803 | ancestor, or cleanly resolved because only one side changed. |
| 804 | <<<<<<< yours:sample.txt |
| 805 | Conflict resolution is hard; |
| 806 | let's go shopping. |
| 807 | ======= |
| 808 | Git makes conflict resolution easy. |
| 809 | >>>>>>> theirs:sample.txt |
| 810 | And here is another line that is cleanly resolved or unmodified.</tt></pre> |
| 811 | </div></div> |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 812 | <div class="para"><p>The area where a pair of conflicting changes happened is marked with markers |
Junio C Hamano | ea82cff | 2009-03-18 01:54:48 | [diff] [blame] | 813 | <tt><<<<<<<</tt>, <tt>=======</tt>, and <tt>>>>>>>></tt>. The part before the <tt>=======</tt> |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 814 | is typically your side, and the part afterwards is typically their side.</p></div> |
| 815 | <div class="para"><p>The default format does not show what the original said in the conflicting |
| 816 | area. You cannot tell how many lines are deleted and replaced with |
| 817 | Barbie's remark on your side. The only thing you can tell is that your |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 818 | side wants to say it is hard and you'd prefer to go shopping, while the |
| 819 | other side wants to claim it is easy.</p></div> |
| 820 | <div class="para"><p>An alternative style can be used by setting the "merge.conflictstyle" |
| 821 | configuration variable to "diff3". In "diff3" style, the above conflict |
| 822 | may look like this:</p></div> |
| 823 | <div class="listingblock"> |
| 824 | <div class="content"> |
| 825 | <pre><tt>Here are lines that are either unchanged from the common |
| 826 | ancestor, or cleanly resolved because only one side changed. |
| 827 | <<<<<<< yours:sample.txt |
| 828 | Conflict resolution is hard; |
| 829 | let's go shopping. |
| 830 | ||||||| |
| 831 | Conflict resolution is hard. |
| 832 | ======= |
| 833 | Git makes conflict resolution easy. |
| 834 | >>>>>>> theirs:sample.txt |
| 835 | And here is another line that is cleanly resolved or unmodified.</tt></pre> |
| 836 | </div></div> |
Junio C Hamano | ea82cff | 2009-03-18 01:54:48 | [diff] [blame] | 837 | <div class="para"><p>In addition to the <tt><<<<<<<</tt>, <tt>=======</tt>, and <tt>>>>>>>></tt> markers, it uses |
| 838 | another <tt>|||||||</tt> marker that is followed by the original text. You can |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 839 | tell that the original just stated a fact, and your side simply gave in to |
| 840 | that statement and gave up, while the other side tried to have a more |
| 841 | positive attitude. You can sometimes come up with a better resolution by |
| 842 | viewing the original.</p></div> |
| 843 | </div> |
| 844 | <h2 id="_how_to_resolve_conflicts">HOW TO RESOLVE CONFLICTS</h2> |
| 845 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 846 | <div class="para"><p>After seeing a conflict, you can do two things:</p></div> |
| 847 | <div class="ilist"><ul> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 848 | <li> |
| 849 | <p> |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 850 | Decide not to merge. The only clean-ups you need are to reset |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 851 | the index file to the <tt>HEAD</tt> commit to reverse 2. and to clean |
Junio C Hamano | 915cd9b | 2008-07-20 01:24:17 | [diff] [blame] | 852 | up working tree changes made by 2. and 3.; <em>git-reset --hard</em> can |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 853 | be used for this. |
| 854 | </p> |
| 855 | </li> |
| 856 | <li> |
| 857 | <p> |
Junio C Hamano | 043628e | 2008-08-24 03:34:11 | [diff] [blame] | 858 | Resolve the conflicts. Git will mark the conflicts in |
| 859 | the working tree. Edit the files into shape and |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 860 | <em>git-add</em> them to the index. Use <em>git-commit</em> to seal the deal. |
Junio C Hamano | 043628e | 2008-08-24 03:34:11 | [diff] [blame] | 861 | </p> |
| 862 | </li> |
| 863 | </ul></div> |
| 864 | <div class="para"><p>You can work through the conflict with a number of tools:</p></div> |
| 865 | <div class="ilist"><ul> |
| 866 | <li> |
| 867 | <p> |
| 868 | Use a mergetool. <em>git mergetool</em> to launch a graphical |
| 869 | mergetool which will work you through the merge. |
| 870 | </p> |
| 871 | </li> |
| 872 | <li> |
| 873 | <p> |
| 874 | Look at the diffs. <em>git diff</em> will show a three-way diff, |
| 875 | highlighting changes from both the HEAD and remote versions. |
| 876 | </p> |
| 877 | </li> |
| 878 | <li> |
| 879 | <p> |
| 880 | Look at the diffs on their own. <em>git log --merge -p <path></em> |
| 881 | will show diffs first for the HEAD version and then the |
| 882 | remote version. |
| 883 | </p> |
| 884 | </li> |
| 885 | <li> |
| 886 | <p> |
| 887 | Look at the originals. <em>git show :1:filename</em> shows the |
| 888 | common ancestor, <em>git show :2:filename</em> shows the HEAD |
| 889 | version and <em>git show :3:filename</em> shows the remote version. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 890 | </p> |
| 891 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 892 | </ul></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 893 | </div> |
Junio C Hamano | c21ab05 | 2009-10-31 04:03:55 | [diff] [blame] | 894 | <h2 id="_examples">EXAMPLES</h2> |
| 895 | <div class="sectionbody"> |
| 896 | <div class="ilist"><ul> |
| 897 | <li> |
| 898 | <p> |
| 899 | Merge branches <tt>fixes</tt> and <tt>enhancements</tt> on top of |
| 900 | the current branch, making an octopus merge: |
| 901 | </p> |
| 902 | <div class="listingblock"> |
| 903 | <div class="content"> |
| 904 | <pre><tt>$ git merge fixes enhancements</tt></pre> |
| 905 | </div></div> |
| 906 | </li> |
| 907 | <li> |
| 908 | <p> |
| 909 | Merge branch <tt>obsolete</tt> into the current branch, using <tt>ours</tt> |
| 910 | merge strategy: |
| 911 | </p> |
| 912 | <div class="listingblock"> |
| 913 | <div class="content"> |
| 914 | <pre><tt>$ git merge -s ours obsolete</tt></pre> |
| 915 | </div></div> |
| 916 | </li> |
| 917 | <li> |
| 918 | <p> |
| 919 | Merge branch <tt>maint</tt> into the current branch, but do not make |
| 920 | a new commit automatically: |
| 921 | </p> |
| 922 | <div class="listingblock"> |
| 923 | <div class="content"> |
| 924 | <pre><tt>$ git merge --no-commit maint</tt></pre> |
| 925 | </div></div> |
| 926 | <div class="para"><p>This can be used when you want to include further changes to the |
| 927 | merge, or want to write your own merge commit message.</p></div> |
| 928 | <div class="para"><p>You should refrain from abusing this option to sneak substantial |
| 929 | changes into a merge commit. Small fixups like bumping |
| 930 | release/version name would be acceptable.</p></div> |
| 931 | </li> |
| 932 | </ul></div> |
| 933 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 934 | <h2 id="_see_also">SEE ALSO</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 935 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 936 | <div class="para"><p><a href="git-fmt-merge-msg.html">git-fmt-merge-msg(1)</a>, <a href="git-pull.html">git-pull(1)</a>, |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 937 | <a href="gitattributes.html">gitattributes(5)</a>, |
| 938 | <a href="git-reset.html">git-reset(1)</a>, |
| 939 | <a href="git-diff.html">git-diff(1)</a>, <a href="git-ls-files.html">git-ls-files(1)</a>, |
| 940 | <a href="git-add.html">git-add(1)</a>, <a href="git-rm.html">git-rm(1)</a>, |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 941 | <a href="git-mergetool.html">git-mergetool(1)</a></p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 942 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 943 | <h2 id="_author">Author</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 944 | <div class="sectionbody"> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 945 | <div class="para"><p>Written by Junio C Hamano <gitster@pobox.com></p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 946 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 947 | <h2 id="_documentation">Documentation</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 948 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 949 | <div class="para"><p>Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 950 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 951 | <h2 id="_git">GIT</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 952 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 953 | <div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 954 | </div> |
| 955 | <div id="footer"> |
| 956 | <div id="footer-text"> |
Junio C Hamano | 3f680f3 | 2009-11-16 02:10:54 | [diff] [blame^] | 957 | Last updated 2009-11-16 02:10:12 UTC |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 958 | </div> |
| 959 | </div> |
| 960 | </body> |
| 961 | </html> |