blob: 68dcbc191b9f6f57f8d76a53f053eb99a4e8bd3c [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Junio C Hamanoba4b9282008-07-06 05:20:316<meta name="generator" content="AsciiDoc 8.2.5" />
Junio C Hamano1a4e8412005-12-27 08:17:237<style type="text/css">
8/* Debug borders */
9p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
10/*
11 border: 1px solid red;
12*/
13}
14
15body {
16 margin: 1em 5% 1em 5%;
17}
18
Junio C Hamanoba4b9282008-07-06 05:20:3119a {
20 color: blue;
21 text-decoration: underline;
22}
23a:visited {
24 color: fuchsia;
25}
Junio C Hamano1a4e8412005-12-27 08:17:2326
27em {
28 font-style: italic;
29}
30
31strong {
32 font-weight: bold;
33}
34
35tt {
36 color: navy;
37}
38
39h1, 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 Hamanoba4b9282008-07-06 05:20:3147h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2348 border-bottom: 2px solid silver;
49}
50h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2351 padding-top: 0.5em;
52}
Junio C Hamanoba4b9282008-07-06 05:20:3153h3 {
54 float: left;
55}
56h3 + * {
57 clear: left;
58}
Junio C Hamano1a4e8412005-12-27 08:17:2359
60div.sectionbody {
61 font-family: serif;
62 margin-left: 0;
63}
64
65hr {
66 border: 1px solid silver;
67}
68
69p {
70 margin-top: 0.5em;
71 margin-bottom: 0.5em;
72}
73
74pre {
75 padding: 0;
76 margin: 0;
77}
78
79span#author {
80 color: #527bbd;
81 font-family: sans-serif;
82 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:3183 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:2384}
85span#email {
86}
87span#revision {
88 font-family: sans-serif;
89}
90
91div#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}
98div#footer-text {
99 float: left;
100 padding-bottom: 0.5em;
101}
102div#footer-badges {
103 float: right;
104 padding-bottom: 0.5em;
105}
106
107div#preamble,
108div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
109div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
110div.admonitionblock {
111 margin-right: 10%;
112 margin-top: 1.5em;
113 margin-bottom: 1.5em;
114}
115div.admonitionblock {
116 margin-top: 2.5em;
117 margin-bottom: 2.5em;
118}
119
120div.content { /* Block element content. */
121 padding: 0;
122}
123
124/* Block element titles. */
125div.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}
132div.title + * {
133 margin-top: 0;
134}
135
136td div.title:first-child {
137 margin-top: 0.0em;
138}
139div.content div.title:first-child {
140 margin-top: 0.0em;
141}
142div.content + div.title {
143 margin-top: 0.0em;
144}
145
146div.sidebarblock > div.content {
147 background: #ffffee;
148 border: 1px solid silver;
149 padding: 0.5em;
150}
151
Junio C Hamanoba4b9282008-07-06 05:20:31152div.listingblock {
153 margin-right: 0%;
154}
Junio C Hamano1a4e8412005-12-27 08:17:23155div.listingblock > div.content {
156 border: 1px solid silver;
157 background: #f4f4f4;
158 padding: 0.5em;
159}
160
161div.quoteblock > div.content {
162 padding-left: 2.0em;
163}
Junio C Hamanoba4b9282008-07-06 05:20:31164
165div.attribution {
Junio C Hamano1a4e8412005-12-27 08:17:23166 text-align: right;
167}
Junio C Hamanoba4b9282008-07-06 05:20:31168div.verseblock + div.attribution {
169 text-align: left;
170}
Junio C Hamano1a4e8412005-12-27 08:17:23171
172div.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}
180div.admonitionblock td.content {
181 padding-left: 0.5em;
182 border-left: 2px solid silver;
183}
184
185div.exampleblock > div.content {
186 border-left: 2px solid silver;
187 padding: 0.5em;
188}
189
190div.verseblock div.content {
191 white-space: pre;
192}
193
194div.imageblock div.content { padding-left: 0; }
195div.imageblock img { border: 1px solid silver; }
196span.image img { border-style: none; }
197
198dl {
199 margin-top: 0.8em;
200 margin-bottom: 0.8em;
201}
202dt {
203 margin-top: 0.5em;
204 margin-bottom: 0;
205 font-style: italic;
206}
207dd > *:first-child {
208 margin-top: 0;
209}
210
211ul, ol {
212 list-style-position: outside;
213}
Junio C Hamanoba4b9282008-07-06 05:20:31214div.olist2 ol {
Junio C Hamano1a4e8412005-12-27 08:17:23215 list-style-type: lower-alpha;
216}
217
218div.tableblock > table {
Junio C Hamanoba4b9282008-07-06 05:20:31219 border: 3px solid #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23220}
221thead {
222 font-family: sans-serif;
223 font-weight: bold;
224}
225tfoot {
226 font-weight: bold;
227}
228
229div.hlist {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
232}
Junio C Hamanoba4b9282008-07-06 05:20:31233div.hlist td {
234 padding-bottom: 5px;
235}
Junio C Hamano1a4e8412005-12-27 08:17:23236td.hlist1 {
237 vertical-align: top;
238 font-style: italic;
239 padding-right: 0.8em;
240}
241td.hlist2 {
242 vertical-align: top;
243}
244
245@media print {
246 div#footer-badges { display: none; }
247}
Junio C Hamanoba4b9282008-07-06 05:20:31248
249div#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
258div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
259 margin-top: 0;
260 margin-bottom: 0;
261}
262div.toclevel2 {
263 margin-left: 2em;
264 font-size: 0.9em;
265}
266div.toclevel3 {
267 margin-left: 4em;
268 font-size: 0.9em;
269}
270div.toclevel4 {
271 margin-left: 6em;
272 font-size: 0.9em;
273}
274include1::./stylesheets/xhtml11-manpage.css[]
Junio C Hamano1a4e8412005-12-27 08:17:23275/* Workarounds for IE6's broken and incomplete CSS2. */
276
277div.sidebar-content {
278 background: #ffffee;
279 border: 1px solid silver;
280 padding: 0.5em;
281}
282div.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
289div.listingblock div.content {
290 border: 1px solid silver;
291 background: #f4f4f4;
292 padding: 0.5em;
293}
294
295div.quoteblock-content {
296 padding-left: 2.0em;
297}
298
299div.exampleblock-content {
300 border-left: 2px solid silver;
301 padding-left: 0.5em;
302}
Junio C Hamanoba4b9282008-07-06 05:20:31303
304/* IE6 sets dynamically generated links as visited. */
305div#toc a:visited { color: blue; }
Junio C Hamano1a4e8412005-12-27 08:17:23306</style>
307<title>git-checkout(1)</title>
308</head>
309<body>
310<div id="header">
311<h1>
312git-checkout(1) Manual Page
313</h1>
314<h2>NAME</h2>
315<div class="sectionbody">
316<p>git-checkout -
Junio C Hamanoa14a4032008-03-25 09:11:02317 Checkout a branch or paths to the working tree
Junio C Hamano1a4e8412005-12-27 08:17:23318</p>
319</div>
320</div>
321<h2>SYNOPSIS</h2>
322<div class="sectionbody">
Junio C Hamano2b135272006-03-18 07:45:42323<div class="verseblock">
Junio C Hamano5cf43ca2008-08-20 09:14:14324<div class="content"><em>git checkout</em> [-q] [-f] [--track | --no-track] [-b &lt;new_branch&gt; [-l]] [-m] [&lt;branch&gt;]
Junio C Hamano3db8b412008-07-26 06:45:59325<em>git checkout</em> [&lt;tree-ish&gt;] [--] &lt;paths&gt;&#8230;</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23326</div>
Junio C Hamanoba4b9282008-07-06 05:20:31327<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23328<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31329<div class="para"><p>When &lt;paths&gt; are not given, this command switches branches by
Junio C Hamano1a4e8412005-12-27 08:17:23330updating the index and working tree to reflect the specified
331branch, &lt;branch&gt;, and updating HEAD to be &lt;branch&gt; or, if
Junio C Hamano2b135272006-03-18 07:45:42332specified, &lt;new_branch&gt;. Using -b will cause &lt;new_branch&gt; to
Junio C Hamano103ad7f2007-03-14 11:19:26333be created; in this case you can use the --track or --no-track
Junio C Hamanoba4b9282008-07-06 05:20:31334options, which will be passed to <tt>git branch</tt>.</p></div>
Junio C Hamano5cf43ca2008-08-20 09:14:14335<div class="para"><p>As a convenience, --track will default to create a branch whose
336name is constructed from the specified branch name by stripping
337the first namespace level.</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:31338<div class="para"><p>When &lt;paths&gt; are given, this command does <strong>not</strong> switch
Junio C Hamano1a4e8412005-12-27 08:17:23339branches. It updates the named paths in the working tree from
Junio C Hamanofce7c7e2008-07-02 03:06:38340the index file (i.e. it runs <tt>git checkout-index -f -u</tt>), or
Junio C Hamano0e3cb532007-04-17 08:28:11341from a named commit. In
342this case, the <tt>-f</tt> and <tt>-b</tt> options are meaningless and giving
Junio C Hamano8f62db92007-02-01 00:22:22343either of them results in an error. &lt;tree-ish&gt; argument can be
344used to specify a specific tree-ish (i.e. commit, tag or tree)
345to update the index for the given paths before updating the
Junio C Hamanoba4b9282008-07-06 05:20:31346working tree.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23347</div>
Junio C Hamanoba4b9282008-07-06 05:20:31348<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23349<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31350<div class="vlist"><dl>
Junio C Hamano1a4e8412005-12-27 08:17:23351<dt>
Junio C Hamano39381a72007-02-02 07:35:15352-q
353</dt>
354<dd>
355<p>
Junio C Hamanocae86272007-08-21 02:20:49356 Quiet, suppress feedback messages.
Junio C Hamano39381a72007-02-02 07:35:15357</p>
358</dd>
359<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23360-f
361</dt>
362<dd>
363<p>
Junio C Hamano0e3cb532007-04-17 08:28:11364 Proceed even if the index or the working tree differs
365 from HEAD. This is used to throw away local changes.
Junio C Hamano1a4e8412005-12-27 08:17:23366</p>
367</dd>
368<dt>
369-b
370</dt>
371<dd>
372<p>
Junio C Hamanob2f5edd2006-05-21 10:50:09373 Create a new branch named &lt;new_branch&gt; and start it at
374 &lt;branch&gt;. The new branch name must pass all checks defined
375 by <a href="git-check-ref-format.html">git-check-ref-format(1)</a>. Some of these checks
376 may restrict the characters allowed in a branch name.
Junio C Hamano1a4e8412005-12-27 08:17:23377</p>
378</dd>
379<dt>
Junio C Hamanoeb415992008-06-08 22:49:47380-t
381</dt>
382<dt>
383--track
Junio C Hamano103ad7f2007-03-14 11:19:26384</dt>
385<dd>
386<p>
Junio C Hamanoba4b9282008-07-06 05:20:31387 When creating a new branch, set up configuration so that <em>git-pull</em>
Junio C Hamano24bc09a2008-02-28 00:27:44388 will automatically retrieve data from the start point, which must be
389 a branch. Use this if you always pull from the same upstream branch
390 into the new branch, and if you don't want to use "git pull
391 &lt;repository&gt; &lt;refspec&gt;" explicitly. This behavior is the default
392 when the start point is a remote branch. Set the
393 branch.autosetupmerge configuration variable to <tt>false</tt> if you want
Junio C Hamanoba4b9282008-07-06 05:20:31394 <em>git-checkout</em> and <em>git-branch</em> to always behave as if <em>--no-track</em> were
Junio C Hamano24bc09a2008-02-28 00:27:44395 given. Set it to <tt>always</tt> if you want this behavior when the
396 start-point is either a local or remote branch.
Junio C Hamano103ad7f2007-03-14 11:19:26397</p>
Junio C Hamano043628e2008-08-24 03:34:11398<div class="para"><p>If no <em>-b</em> option was given, the name of the new branch will be
399derived from the remote branch, by attempting to guess the name
400of the branch on remote system. If "remotes/" or "refs/remotes/"
401are prefixed, it is stripped away, and then the part up to the
402next slash (which would be the nickname of the remote) is removed.
403This would tell us to use "hack" as the local branch when branching
404off of "origin/hack" (or "remotes/origin/hack", or even
405"refs/remotes/origin/hack"). If the given name has no slash, or the above
406guessing results in an empty name, the guessing is aborted. You can
407exlicitly give a name with <em>-b</em> in such a case.</p></div>
Junio C Hamano103ad7f2007-03-14 11:19:26408</dd>
409<dt>
410--no-track
411</dt>
412<dd>
413<p>
Junio C Hamano24bc09a2008-02-28 00:27:44414 Ignore the branch.autosetupmerge configuration variable.
Junio C Hamano103ad7f2007-03-14 11:19:26415</p>
416</dd>
417<dt>
Junio C Hamano341071d2006-06-04 07:24:48418-l
419</dt>
420<dd>
421<p>
Junio C Hamano1d90cb02007-07-03 07:05:31422 Create the new branch's reflog. This activates recording of
423 all changes made to the branch ref, enabling use of date
424 based sha1 expressions such as "&lt;branchname&gt;@{yesterday}".
Junio C Hamano341071d2006-06-04 07:24:48425</p>
426</dd>
427<dt>
Junio C Hamano74e8a2d2006-01-14 03:58:41428-m
429</dt>
430<dd>
431<p>
Junio C Hamano2b135272006-03-18 07:45:42432 If you have local modifications to one or more files that
433 are different between the current branch and the branch to
434 which you are switching, the command refuses to switch
435 branches in order to preserve your modifications in context.
436 However, with this option, a three-way merge between the current
Junio C Hamano74e8a2d2006-01-14 03:58:41437 branch, your working tree contents, and the new branch
438 is done, and you will be on the new branch.
439</p>
Junio C Hamanoba4b9282008-07-06 05:20:31440<div class="para"><p>When a merge conflict happens, the index entries for conflicting
Junio C Hamano74e8a2d2006-01-14 03:58:41441paths are left unmerged, and you need to resolve the conflicts
Junio C Hamano89d4e0f2007-02-18 00:34:59442and mark the resolved paths with <tt>git add</tt> (or <tt>git rm</tt> if the merge
Junio C Hamanoba4b9282008-07-06 05:20:31443should result in deletion of the path).</p></div>
Junio C Hamano74e8a2d2006-01-14 03:58:41444</dd>
445<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23446&lt;new_branch&gt;
447</dt>
448<dd>
449<p>
450 Name for the new branch.
451</p>
452</dd>
453<dt>
454&lt;branch&gt;
455</dt>
456<dd>
457<p>
458 Branch to checkout; may be any object ID that resolves to a
Junio C Hamano4f9a6052007-01-17 20:25:16459 commit. Defaults to HEAD.
Junio C Hamano1a4e8412005-12-27 08:17:23460</p>
Junio C Hamanoba4b9282008-07-06 05:20:31461<div class="para"><p>When this parameter names a non-branch (but still a valid commit object),
462your HEAD becomes <em>detached</em>.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23463</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31464</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:23465</div>
Junio C Hamanoba4b9282008-07-06 05:20:31466<h2 id="_detached_head">Detached HEAD</h2>
Junio C Hamano4f9a6052007-01-17 20:25:16467<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31468<div class="para"><p>It is sometimes useful to be able to <em>checkout</em> a commit that is
Junio C Hamano4f9a6052007-01-17 20:25:16469not at the tip of one of your branches. The most obvious
470example is to check out the commit at a tagged official release
Junio C Hamanoba4b9282008-07-06 05:20:31471point, like this:</p></div>
Junio C Hamano4f9a6052007-01-17 20:25:16472<div class="listingblock">
473<div class="content">
474<pre><tt>$ git checkout v2.6.18</tt></pre>
475</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31476<div class="para"><p>Earlier versions of git did not allow this and asked you to
Junio C Hamano4f9a6052007-01-17 20:25:16477create a temporary branch using <tt>-b</tt> option, but starting from
478version 1.5.0, the above command <em>detaches</em> your HEAD from the
479current branch and directly point at the commit named by the tag
Junio C Hamanoba4b9282008-07-06 05:20:31480(<tt>v2.6.18</tt> in the above example).</p></div>
481<div class="para"><p>You can use usual git commands while in this state. You can use
Junio C Hamanofce7c7e2008-07-02 03:06:38482<tt>git reset --hard $othercommit</tt> to further move around, for
Junio C Hamano4f9a6052007-01-17 20:25:16483example. You can make changes and create a new commit on top of
484a detached HEAD. You can even create a merge by using <tt>git
Junio C Hamanoba4b9282008-07-06 05:20:31485merge $othercommit</tt>.</p></div>
486<div class="para"><p>The state you are in while your HEAD is detached is not recorded
Junio C Hamano4f9a6052007-01-17 20:25:16487by any branch (which is natural --- you are not on any branch).
488What this means is that you can discard your temporary commits
489and merges by switching back to an existing branch (e.g. <tt>git
490checkout master</tt>), and a later <tt>git prune</tt> or <tt>git gc</tt> would
Junio C Hamano9d52e572007-02-13 23:48:20491garbage-collect them. If you did this by mistake, you can ask
Junio C Hamanoba4b9282008-07-06 05:20:31492the reflog for HEAD where you were, e.g.</p></div>
Junio C Hamano9d52e572007-02-13 23:48:20493<div class="listingblock">
494<div class="content">
495<pre><tt>$ git log -g -2 HEAD</tt></pre>
496</div></div>
Junio C Hamano4f9a6052007-01-17 20:25:16497</div>
Junio C Hamanoba4b9282008-07-06 05:20:31498<h2 id="_examples">EXAMPLES</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23499<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31500<div class="olist"><ol>
Junio C Hamano74e8a2d2006-01-14 03:58:41501<li>
502<p>
503The following sequence checks out the <tt>master</tt> branch, reverts
Junio C Hamano1a4e8412005-12-27 08:17:23504the <tt>Makefile</tt> to two revisions back, deletes hello.c by
Junio C Hamano74e8a2d2006-01-14 03:58:41505mistake, and gets it back from the index.
506</p>
Junio C Hamano1a4e8412005-12-27 08:17:23507<div class="listingblock">
508<div class="content">
Junio C Hamanoc8d88c22006-04-29 07:02:01509<pre><tt>$ git checkout master <b>(1)</b>
510$ git checkout master~2 Makefile <b>(2)</b>
Junio C Hamano1a4e8412005-12-27 08:17:23511$ rm -f hello.c
Junio C Hamanoc8d88c22006-04-29 07:02:01512$ git checkout hello.c <b>(3)</b></tt></pre>
Junio C Hamano1a4e8412005-12-27 08:17:23513</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31514<div class="colist"><ol>
Junio C Hamanoc8d88c22006-04-29 07:02:01515<li>
516<p>
517switch branch
518</p>
519</li>
520<li>
521<p>
522take out a file out of other commit
523</p>
524</li>
525<li>
526<p>
527restore hello.c from HEAD of current branch
528</p>
Junio C Hamanoba4b9282008-07-06 05:20:31529<div class="para"><p>If you have an unfortunate branch that is named <tt>hello.c</tt>, this
Junio C Hamanoc8d88c22006-04-29 07:02:01530step would be confused as an instruction to switch to that branch.
Junio C Hamanoba4b9282008-07-06 05:20:31531You should instead write:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23532<div class="listingblock">
533<div class="content">
534<pre><tt>$ git checkout -- hello.c</tt></pre>
535</div></div>
Junio C Hamano74e8a2d2006-01-14 03:58:41536</li>
Junio C Hamanoba4b9282008-07-06 05:20:31537</ol></div>
Junio C Hamanoc8d88c22006-04-29 07:02:01538</li>
Junio C Hamano74e8a2d2006-01-14 03:58:41539<li>
540<p>
541After working in a wrong branch, switching to the correct
Junio C Hamano2b135272006-03-18 07:45:42542branch would be done using:
Junio C Hamano74e8a2d2006-01-14 03:58:41543</p>
544<div class="listingblock">
545<div class="content">
546<pre><tt>$ git checkout mytopic</tt></pre>
547</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31548<div class="para"><p>However, your "wrong" branch and correct "mytopic" branch may
Junio C Hamano74e8a2d2006-01-14 03:58:41549differ in files that you have locally modified, in which case,
Junio C Hamanoba4b9282008-07-06 05:20:31550the above checkout would fail like this:</p></div>
Junio C Hamano74e8a2d2006-01-14 03:58:41551<div class="listingblock">
552<div class="content">
553<pre><tt>$ git checkout mytopic
554fatal: Entry 'frotz' not uptodate. Cannot merge.</tt></pre>
555</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31556<div class="para"><p>You can give the <tt>-m</tt> flag to the command, which would try a
557three-way merge:</p></div>
Junio C Hamano74e8a2d2006-01-14 03:58:41558<div class="listingblock">
559<div class="content">
560<pre><tt>$ git checkout -m mytopic
561Auto-merging frotz</tt></pre>
562</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31563<div class="para"><p>After this three-way merge, the local modifications are <em>not</em>
Junio C Hamano74e8a2d2006-01-14 03:58:41564registered in your index file, so <tt>git diff</tt> would show you what
Junio C Hamanoba4b9282008-07-06 05:20:31565changes you made since the tip of the new branch.</p></div>
Junio C Hamano74e8a2d2006-01-14 03:58:41566</li>
567<li>
568<p>
569When a merge conflict happens during switching branches with
570the <tt>-m</tt> option, you would see something like this:
571</p>
572<div class="listingblock">
573<div class="content">
574<pre><tt>$ git checkout -m mytopic
575Auto-merging frotz
576merge: warning: conflicts during merge
577ERROR: Merge conflict in frotz
578fatal: merge program failed</tt></pre>
579</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31580<div class="para"><p>At this point, <tt>git diff</tt> shows the changes cleanly merged as in
Junio C Hamano74e8a2d2006-01-14 03:58:41581the previous example, as well as the changes in the conflicted
582files. Edit and resolve the conflict and mark it resolved with
Junio C Hamanoba4b9282008-07-06 05:20:31583<tt>git add</tt> as usual:</p></div>
Junio C Hamano74e8a2d2006-01-14 03:58:41584<div class="listingblock">
585<div class="content">
586<pre><tt>$ edit frotz
Junio C Hamano89d4e0f2007-02-18 00:34:59587$ git add frotz</tt></pre>
Junio C Hamano74e8a2d2006-01-14 03:58:41588</div></div>
589</li>
Junio C Hamanoba4b9282008-07-06 05:20:31590</ol></div>
Junio C Hamano1a4e8412005-12-27 08:17:23591</div>
Junio C Hamanoba4b9282008-07-06 05:20:31592<h2 id="_author">Author</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23593<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31594<div class="para"><p>Written by Linus Torvalds &lt;torvalds@osdl.org&gt;</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23595</div>
Junio C Hamanoba4b9282008-07-06 05:20:31596<h2 id="_documentation">Documentation</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23597<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31598<div class="para"><p>Documentation by Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23599</div>
Junio C Hamanoba4b9282008-07-06 05:20:31600<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23601<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31602<div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23603</div>
604<div id="footer">
605<div id="footer-text">
Junio C Hamano043628e2008-08-24 03:34:11606Last updated 2008-08-24 03:33:55 UTC
Junio C Hamano1a4e8412005-12-27 08:17:23607</div>
608</div>
609</body>
610</html>