Autogenerated HTML docs for v1.7.4-rc1-5-ge17aa
[git/jnareb-git.git] / git-checkout.html
blobf4c8484ec11ffbb79bd8ad41bd17a654421348e2
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" />
6 <meta name="generator" content="AsciiDoc 8.4.5" />
7 <title>git-checkout(1)</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
12 border: 1px solid red;
16 body {
17 margin: 1em 5% 1em 5%;
20 a {
21 color: blue;
22 text-decoration: underline;
24 a:visited {
25 color: fuchsia;
28 em {
29 font-style: italic;
30 color: navy;
33 strong {
34 font-weight: bold;
35 color: #083194;
38 tt {
39 color: navy;
42 h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
53 h2 {
54 padding-top: 0.5em;
56 h3 {
57 float: left;
59 h3 + * {
60 clear: left;
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
68 hr {
69 border: 1px solid silver;
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
77 ul, ol, li > p {
78 margin-top: 0;
81 pre {
82 padding: 0;
83 margin: 0;
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
92 span#email {
94 span#revnumber, span#revdate, span#revremark {
95 font-family: sans-serif;
98 div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
114 div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120 div.admonitionblock {
121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.5em;
126 margin-bottom: 2.5em;
129 div.content { /* Block element content. */
130 padding: 0;
133 /* Block element titles. */
134 div.title, caption.title {
135 color: #527bbd;
136 font-family: sans-serif;
137 font-weight: bold;
138 text-align: left;
139 margin-top: 1.0em;
140 margin-bottom: 0.5em;
142 div.title + * {
143 margin-top: 0;
146 td div.title:first-child {
147 margin-top: 0.0em;
149 div.content div.title:first-child {
150 margin-top: 0.0em;
152 div.content + div.title {
153 margin-top: 0.0em;
156 div.sidebarblock > div.content {
157 background: #ffffee;
158 border: 1px solid silver;
159 padding: 0.5em;
162 div.listingblock > div.content {
163 border: 1px solid silver;
164 background: #f4f4f4;
165 padding: 0.5em;
168 div.quoteblock {
169 padding-left: 2.0em;
170 margin-right: 10%;
172 div.quoteblock > div.attribution {
173 padding-top: 0.5em;
174 text-align: right;
177 div.verseblock {
178 padding-left: 2.0em;
179 margin-right: 10%;
181 div.verseblock > div.content {
182 white-space: pre;
184 div.verseblock > div.attribution {
185 padding-top: 0.75em;
186 text-align: left;
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div.verseblock + div.attribution {
190 text-align: left;
193 div.admonitionblock .icon {
194 vertical-align: top;
195 font-size: 1.1em;
196 font-weight: bold;
197 text-decoration: underline;
198 color: #527bbd;
199 padding-right: 0.5em;
201 div.admonitionblock td.content {
202 padding-left: 0.5em;
203 border-left: 2px solid silver;
206 div.exampleblock > div.content {
207 border-left: 2px solid silver;
208 padding: 0.5em;
211 div.imageblock div.content { padding-left: 0; }
212 span.image img { border-style: none; }
213 a.image:visited { color: white; }
215 dl {
216 margin-top: 0.8em;
217 margin-bottom: 0.8em;
219 dt {
220 margin-top: 0.5em;
221 margin-bottom: 0;
222 font-style: normal;
223 color: navy;
225 dd > *:first-child {
226 margin-top: 0.1em;
229 ul, ol {
230 list-style-position: outside;
232 ol.arabic {
233 list-style-type: decimal;
235 ol.loweralpha {
236 list-style-type: lower-alpha;
238 ol.upperalpha {
239 list-style-type: upper-alpha;
241 ol.lowerroman {
242 list-style-type: lower-roman;
244 ol.upperroman {
245 list-style-type: upper-roman;
248 div.compact ul, div.compact ol,
249 div.compact p, div.compact p,
250 div.compact div, div.compact div {
251 margin-top: 0.1em;
252 margin-bottom: 0.1em;
255 div.tableblock > table {
256 border: 3px solid #527bbd;
258 thead {
259 font-family: sans-serif;
260 font-weight: bold;
262 tfoot {
263 font-weight: bold;
265 td > div.verse {
266 white-space: pre;
268 p.table {
269 margin-top: 0;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div.tableblock > table[frame="void"] {
273 border-style: none;
275 div.tableblock > table[frame="hsides"] {
276 border-left-style: none;
277 border-right-style: none;
279 div.tableblock > table[frame="vsides"] {
280 border-top-style: none;
281 border-bottom-style: none;
285 div.hdlist {
286 margin-top: 0.8em;
287 margin-bottom: 0.8em;
289 div.hdlist tr {
290 padding-bottom: 15px;
292 dt.hdlist1.strong, td.hdlist1.strong {
293 font-weight: bold;
295 td.hdlist1 {
296 vertical-align: top;
297 font-style: normal;
298 padding-right: 0.8em;
299 color: navy;
301 td.hdlist2 {
302 vertical-align: top;
304 div.hdlist.compact tr {
305 margin: 0;
306 padding-bottom: 0;
309 .comment {
310 background: yellow;
313 @media print {
314 div#footer-badges { display: none; }
317 div#toctitle {
318 color: #527bbd;
319 font-family: sans-serif;
320 font-size: 1.1em;
321 font-weight: bold;
322 margin-top: 1.0em;
323 margin-bottom: 0.1em;
326 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
327 margin-top: 0;
328 margin-bottom: 0;
330 div.toclevel2 {
331 margin-left: 2em;
332 font-size: 0.9em;
334 div.toclevel3 {
335 margin-left: 4em;
336 font-size: 0.9em;
338 div.toclevel4 {
339 margin-left: 6em;
340 font-size: 0.9em;
342 /* Overrides for manpage documents */
343 h1 {
344 padding-top: 0.5em;
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver;
347 border-bottom: 2px solid silver;
349 h2 {
350 border-style: none;
352 div.sectionbody {
353 margin-left: 5%;
356 @media print {
357 div#toc { display: none; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div.sidebar-content {
363 background: #ffffee;
364 border: 1px solid silver;
365 padding: 0.5em;
367 div.sidebar-title, div.image-title {
368 color: #527bbd;
369 font-family: sans-serif;
370 font-weight: bold;
371 margin-top: 0.0em;
372 margin-bottom: 0.5em;
375 div.listingblock div.content {
376 border: 1px solid silver;
377 background: #f4f4f4;
378 padding: 0.5em;
381 div.quoteblock-attribution {
382 padding-top: 0.5em;
383 text-align: right;
386 div.verseblock-content {
387 white-space: pre;
389 div.verseblock-attribution {
390 padding-top: 0.75em;
391 text-align: left;
394 div.exampleblock-content {
395 border-left: 2px solid silver;
396 padding-left: 0.5em;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc a:visited { color: blue; }
401 </style>
402 </head>
403 <body>
404 <div id="header">
405 <h1>
406 git-checkout(1) Manual Page
407 </h1>
408 <h2>NAME</h2>
409 <div class="sectionbody">
410 <p>git-checkout -
411 Checkout a branch or paths to the working tree
412 </p>
413 </div>
414 </div>
415 <h2 id="_synopsis">SYNOPSIS</h2>
416 <div class="sectionbody">
417 <div class="verseblock">
418 <div class="verseblock-content"><em>git checkout</em> [-q] [-f] [-m] [&lt;branch&gt;]
419 <em>git checkout</em> [-q] [-f] [-m] [[-b|-B|--orphan] &lt;new_branch&gt;] [&lt;start_point&gt;]
420 <em>git checkout</em> [-f|--ours|--theirs|-m|--conflict=&lt;style&gt;] [&lt;tree-ish&gt;] [--] &lt;paths&gt;&#8230;
421 <em>git checkout</em> --patch [&lt;tree-ish&gt;] [--] [&lt;paths&gt;&#8230;]</div>
422 <div class="verseblock-attribution">
423 </div></div>
424 </div>
425 <h2 id="_description">DESCRIPTION</h2>
426 <div class="sectionbody">
427 <div class="paragraph"><p>Updates files in the working tree to match the version in the index
428 or the specified tree. If no paths are given, <em>git checkout</em> will
429 also update <tt>HEAD</tt> to set the specified branch as the current
430 branch.</p></div>
431 <div class="dlist"><dl>
432 <dt class="hdlist1">
433 <em>git checkout</em> [&lt;branch&gt;]
434 </dt>
435 <dt class="hdlist1">
436 <em>git checkout</em> -b|-B &lt;new_branch&gt; [&lt;start point&gt;]
437 </dt>
438 <dd>
440 This form switches branches by updating the index, working
441 tree, and HEAD to reflect the specified branch.
442 </p>
443 <div class="paragraph"><p>If <tt>-b</tt> is given, a new branch is created as if <a href="git-branch.html">git-branch(1)</a>
444 were called and then checked out; in this case you can
445 use the <tt>--track</tt> or <tt>--no-track</tt> options, which will be passed to
446 <em>git branch</em>. As a convenience, <tt>--track</tt> without <tt>-b</tt> implies branch
447 creation; see the description of <tt>--track</tt> below.</p></div>
448 <div class="paragraph"><p>If <tt>-B</tt> is given, &lt;new_branch&gt; is created if it doesn&#8217;t exist; otherwise, it
449 is reset. This is the transactional equivalent of</p></div>
450 <div class="listingblock">
451 <div class="content">
452 <pre><tt>$ git branch -f &lt;branch&gt; [&lt;start point&gt;]
453 $ git checkout &lt;branch&gt;</tt></pre>
454 </div></div>
455 <div class="paragraph"><p>that is to say, the branch is not reset/created unless "git checkout" is
456 successful.</p></div>
457 </dd>
458 <dt class="hdlist1">
459 <em>git checkout</em> [--patch] [&lt;tree-ish&gt;] [--] &lt;pathspec&gt;&#8230;
460 </dt>
461 <dd>
463 When &lt;paths&gt; or <tt>--patch</tt> are given, <em>git checkout</em> does <strong>not</strong>
464 switch branches. It updates the named paths in the working tree
465 from the index file or from a named &lt;tree-ish&gt; (most often a
466 commit). In this case, the <tt>-b</tt> and <tt>--track</tt> options are
467 meaningless and giving either of them results in an error. The
468 &lt;tree-ish&gt; argument can be used to specify a specific tree-ish
469 (i.e. commit, tag or tree) to update the index for the given
470 paths before updating the working tree.
471 </p>
472 <div class="paragraph"><p>The index may contain unmerged entries because of a previous failed merge.
473 By default, if you try to check out such an entry from the index, the
474 checkout operation will fail and nothing will be checked out.
475 Using <tt>-f</tt> will ignore these unmerged entries. The contents from a
476 specific side of the merge can be checked out of the index by
477 using <tt>--ours</tt> or <tt>--theirs</tt>. With <tt>-m</tt>, changes made to the working tree
478 file can be discarded to re-create the original conflicted merge result.</p></div>
479 </dd>
480 </dl></div>
481 </div>
482 <h2 id="_options">OPTIONS</h2>
483 <div class="sectionbody">
484 <div class="dlist"><dl>
485 <dt class="hdlist1">
487 </dt>
488 <dt class="hdlist1">
489 --quiet
490 </dt>
491 <dd>
493 Quiet, suppress feedback messages.
494 </p>
495 </dd>
496 <dt class="hdlist1">
498 </dt>
499 <dt class="hdlist1">
500 --force
501 </dt>
502 <dd>
504 When switching branches, proceed even if the index or the
505 working tree differs from HEAD. This is used to throw away
506 local changes.
507 </p>
508 <div class="paragraph"><p>When checking out paths from the index, do not fail upon unmerged
509 entries; instead, unmerged entries are ignored.</p></div>
510 </dd>
511 <dt class="hdlist1">
512 --ours
513 </dt>
514 <dt class="hdlist1">
515 --theirs
516 </dt>
517 <dd>
519 When checking out paths from the index, check out stage #2
520 (<em>ours</em>) or #3 (<em>theirs</em>) for unmerged paths.
521 </p>
522 </dd>
523 <dt class="hdlist1">
525 </dt>
526 <dd>
528 Create a new branch named &lt;new_branch&gt; and start it at
529 &lt;start_point&gt;; see <a href="git-branch.html">git-branch(1)</a> for details.
530 </p>
531 </dd>
532 <dt class="hdlist1">
534 </dt>
535 <dd>
537 Creates the branch &lt;new_branch&gt; and start it at &lt;start_point&gt;;
538 if it already exists, then reset it to &lt;start_point&gt;. This is
539 equivalent to running "git branch" with "-f"; see
540 <a href="git-branch.html">git-branch(1)</a> for details.
541 </p>
542 </dd>
543 <dt class="hdlist1">
545 </dt>
546 <dt class="hdlist1">
547 --track
548 </dt>
549 <dd>
551 When creating a new branch, set up "upstream" configuration. See
552 "--track" in <a href="git-branch.html">git-branch(1)</a> for details.
553 </p>
554 <div class="paragraph"><p>If no <em>-b</em> option is given, the name of the new branch will be
555 derived from the remote-tracking branch. If "remotes/" or "refs/remotes/"
556 is prefixed it is stripped away, and then the part up to the
557 next slash (which would be the nickname of the remote) is removed.
558 This would tell us to use "hack" as the local branch when branching
559 off of "origin/hack" (or "remotes/origin/hack", or even
560 "refs/remotes/origin/hack"). If the given name has no slash, or the above
561 guessing results in an empty name, the guessing is aborted. You can
562 explicitly give a name with <em>-b</em> in such a case.</p></div>
563 </dd>
564 <dt class="hdlist1">
565 --no-track
566 </dt>
567 <dd>
569 Do not set up "upstream" configuration, even if the
570 branch.autosetupmerge configuration variable is true.
571 </p>
572 </dd>
573 <dt class="hdlist1">
575 </dt>
576 <dd>
578 Create the new branch&#8217;s reflog; see <a href="git-branch.html">git-branch(1)</a> for
579 details.
580 </p>
581 </dd>
582 <dt class="hdlist1">
583 --orphan
584 </dt>
585 <dd>
587 Create a new <em>orphan</em> branch, named &lt;new_branch&gt;, started from
588 &lt;start_point&gt; and switch to it. The first commit made on this
589 new branch will have no parents and it will be the root of a new
590 history totally disconnected from all the other branches and
591 commits.
592 </p>
593 <div class="paragraph"><p>The index and the working tree are adjusted as if you had previously run
594 "git checkout &lt;start_point&gt;". This allows you to start a new history
595 that records a set of paths similar to &lt;start_point&gt; by easily running
596 "git commit -a" to make the root commit.</p></div>
597 <div class="paragraph"><p>This can be useful when you want to publish the tree from a commit
598 without exposing its full history. You might want to do this to publish
599 an open source branch of a project whose current tree is "clean", but
600 whose full history contains proprietary or otherwise encumbered bits of
601 code.</p></div>
602 <div class="paragraph"><p>If you want to start a disconnected history that records a set of paths
603 that is totally different from the one of &lt;start_point&gt;, then you should
604 clear the index and the working tree right after creating the orphan
605 branch by running "git rm -rf ." from the top level of the working tree.
606 Afterwards you will be ready to prepare your new files, repopulating the
607 working tree, by copying them from elsewhere, extracting a tarball, etc.</p></div>
608 </dd>
609 <dt class="hdlist1">
611 </dt>
612 <dt class="hdlist1">
613 --merge
614 </dt>
615 <dd>
617 When switching branches,
618 if you have local modifications to one or more files that
619 are different between the current branch and the branch to
620 which you are switching, the command refuses to switch
621 branches in order to preserve your modifications in context.
622 However, with this option, a three-way merge between the current
623 branch, your working tree contents, and the new branch
624 is done, and you will be on the new branch.
625 </p>
626 <div class="paragraph"><p>When a merge conflict happens, the index entries for conflicting
627 paths are left unmerged, and you need to resolve the conflicts
628 and mark the resolved paths with <tt>git add</tt> (or <tt>git rm</tt> if the merge
629 should result in deletion of the path).</p></div>
630 <div class="paragraph"><p>When checking out paths from the index, this option lets you recreate
631 the conflicted merge in the specified paths.</p></div>
632 </dd>
633 <dt class="hdlist1">
634 --conflict=&lt;style&gt;
635 </dt>
636 <dd>
638 The same as --merge option above, but changes the way the
639 conflicting hunks are presented, overriding the
640 merge.conflictstyle configuration variable. Possible values are
641 "merge" (default) and "diff3" (in addition to what is shown by
642 "merge" style, shows the original contents).
643 </p>
644 </dd>
645 <dt class="hdlist1">
647 </dt>
648 <dt class="hdlist1">
649 --patch
650 </dt>
651 <dd>
653 Interactively select hunks in the difference between the
654 &lt;tree-ish&gt; (or the index, if unspecified) and the working
655 tree. The chosen hunks are then applied in reverse to the
656 working tree (and if a &lt;tree-ish&gt; was specified, the index).
657 </p>
658 <div class="paragraph"><p>This means that you can use <tt>git checkout -p</tt> to selectively discard
659 edits from your current working tree.</p></div>
660 </dd>
661 <dt class="hdlist1">
662 &lt;branch&gt;
663 </dt>
664 <dd>
666 Branch to checkout; if it refers to a branch (i.e., a name that,
667 when prepended with "refs/heads/", is a valid ref), then that
668 branch is checked out. Otherwise, if it refers to a valid
669 commit, your HEAD becomes "detached" and you are no longer on
670 any branch (see below for details).
671 </p>
672 <div class="paragraph"><p>As a special case, the <tt>"@{-N}"</tt> syntax for the N-th last branch
673 checks out the branch (instead of detaching). You may also specify
674 <tt>-</tt> which is synonymous with <tt>"@{-1}"</tt>.</p></div>
675 <div class="paragraph"><p>As a further special case, you may use <tt>"A...B"</tt> as a shortcut for the
676 merge base of <tt>A</tt> and <tt>B</tt> if there is exactly one merge base. You can
677 leave out at most one of <tt>A</tt> and <tt>B</tt>, in which case it defaults to <tt>HEAD</tt>.</p></div>
678 </dd>
679 <dt class="hdlist1">
680 &lt;new_branch&gt;
681 </dt>
682 <dd>
684 Name for the new branch.
685 </p>
686 </dd>
687 <dt class="hdlist1">
688 &lt;start_point&gt;
689 </dt>
690 <dd>
692 The name of a commit at which to start the new branch; see
693 <a href="git-branch.html">git-branch(1)</a> for details. Defaults to HEAD.
694 </p>
695 </dd>
696 <dt class="hdlist1">
697 &lt;tree-ish&gt;
698 </dt>
699 <dd>
701 Tree to checkout from (when paths are given). If not specified,
702 the index will be used.
703 </p>
704 </dd>
705 </dl></div>
706 </div>
707 <h2 id="_detached_head">Detached HEAD</h2>
708 <div class="sectionbody">
709 <div class="paragraph"><p>It is sometimes useful to be able to <em>checkout</em> a commit that is
710 not at the tip of one of your branches. The most obvious
711 example is to check out the commit at a tagged official release
712 point, like this:</p></div>
713 <div class="listingblock">
714 <div class="content">
715 <pre><tt>$ git checkout v2.6.18</tt></pre>
716 </div></div>
717 <div class="paragraph"><p>Earlier versions of git did not allow this and asked you to
718 create a temporary branch using the <tt>-b</tt> option, but starting from
719 version 1.5.0, the above command <em>detaches</em> your HEAD from the
720 current branch and directly points at the commit named by the tag
721 (<tt>v2.6.18</tt> in the example above).</p></div>
722 <div class="paragraph"><p>You can use all git commands while in this state. You can use
723 <tt>git reset --hard $othercommit</tt> to further move around, for
724 example. You can make changes and create a new commit on top of
725 a detached HEAD. You can even create a merge by using <tt>git
726 merge $othercommit</tt>.</p></div>
727 <div class="paragraph"><p>The state you are in while your HEAD is detached is not recorded
728 by any branch (which is natural --- you are not on any branch).
729 What this means is that you can discard your temporary commits
730 and merges by switching back to an existing branch (e.g. <tt>git
731 checkout master</tt>), and a later <tt>git prune</tt> or <tt>git gc</tt> would
732 garbage-collect them. If you did this by mistake, you can ask
733 the reflog for HEAD where you were, e.g.</p></div>
734 <div class="listingblock">
735 <div class="content">
736 <pre><tt>$ git log -g -2 HEAD</tt></pre>
737 </div></div>
738 </div>
739 <h2 id="_examples">EXAMPLES</h2>
740 <div class="sectionbody">
741 <div class="olist arabic"><ol class="arabic">
742 <li>
744 The following sequence checks out the <tt>master</tt> branch, reverts
745 the <tt>Makefile</tt> to two revisions back, deletes hello.c by
746 mistake, and gets it back from the index.
747 </p>
748 <div class="listingblock">
749 <div class="content">
750 <pre><tt>$ git checkout master <b>&lt;1&gt;</b>
751 $ git checkout master~2 Makefile <b>&lt;2&gt;</b>
752 $ rm -f hello.c
753 $ git checkout hello.c <b>&lt;3&gt;</b></tt></pre>
754 </div></div>
755 <div class="colist arabic"><ol>
756 <li>
758 switch branch
759 </p>
760 </li>
761 <li>
763 take a file out of another commit
764 </p>
765 </li>
766 <li>
768 restore hello.c from the index
769 </p>
770 <div class="paragraph"><p>If you have an unfortunate branch that is named <tt>hello.c</tt>, this
771 step would be confused as an instruction to switch to that branch.
772 You should instead write:</p></div>
773 <div class="listingblock">
774 <div class="content">
775 <pre><tt>$ git checkout -- hello.c</tt></pre>
776 </div></div>
777 </li>
778 </ol></div>
779 </li>
780 <li>
782 After working in the wrong branch, switching to the correct
783 branch would be done using:
784 </p>
785 <div class="listingblock">
786 <div class="content">
787 <pre><tt>$ git checkout mytopic</tt></pre>
788 </div></div>
789 <div class="paragraph"><p>However, your "wrong" branch and correct "mytopic" branch may
790 differ in files that you have modified locally, in which case
791 the above checkout would fail like this:</p></div>
792 <div class="listingblock">
793 <div class="content">
794 <pre><tt>$ git checkout mytopic
795 error: You have local changes to 'frotz'; not switching branches.</tt></pre>
796 </div></div>
797 <div class="paragraph"><p>You can give the <tt>-m</tt> flag to the command, which would try a
798 three-way merge:</p></div>
799 <div class="listingblock">
800 <div class="content">
801 <pre><tt>$ git checkout -m mytopic
802 Auto-merging frotz</tt></pre>
803 </div></div>
804 <div class="paragraph"><p>After this three-way merge, the local modifications are <em>not</em>
805 registered in your index file, so <tt>git diff</tt> would show you what
806 changes you made since the tip of the new branch.</p></div>
807 </li>
808 <li>
810 When a merge conflict happens during switching branches with
811 the <tt>-m</tt> option, you would see something like this:
812 </p>
813 <div class="listingblock">
814 <div class="content">
815 <pre><tt>$ git checkout -m mytopic
816 Auto-merging frotz
817 ERROR: Merge conflict in frotz
818 fatal: merge program failed</tt></pre>
819 </div></div>
820 <div class="paragraph"><p>At this point, <tt>git diff</tt> shows the changes cleanly merged as in
821 the previous example, as well as the changes in the conflicted
822 files. Edit and resolve the conflict and mark it resolved with
823 <tt>git add</tt> as usual:</p></div>
824 <div class="listingblock">
825 <div class="content">
826 <pre><tt>$ edit frotz
827 $ git add frotz</tt></pre>
828 </div></div>
829 </li>
830 </ol></div>
831 </div>
832 <h2 id="_author">Author</h2>
833 <div class="sectionbody">
834 <div class="paragraph"><p>Written by Linus Torvalds &lt;<a href="mailto:torvalds@osdl.org">torvalds@osdl.org</a>&gt;</p></div>
835 </div>
836 <h2 id="_documentation">Documentation</h2>
837 <div class="sectionbody">
838 <div class="paragraph"><p>Documentation by Junio C Hamano and the git-list &lt;<a href="mailto:git@vger.kernel.org">git@vger.kernel.org</a>&gt;.</p></div>
839 </div>
840 <h2 id="_git">GIT</h2>
841 <div class="sectionbody">
842 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
843 </div>
844 <div id="footer">
845 <div id="footer-text">
846 Last updated 2010-11-25 03:13:40 UTC
847 </div>
848 </div>
849 </body>
850 </html>