summaryrefslogtreecommitdiffstats
path: root/gittutorial.html
diff options
context:
space:
mode:
authorJunio C Hamano <junio@hera.kernel.org>2008-07-15 15:49:03 +0000
committerJunio C Hamano <junio@hera.kernel.org>2008-07-15 15:49:03 +0000
commit38ddcce0c19a8eedec7a98bd291f65b2127a82b9 (patch)
treebc44e0dbf17d91c4eec1fdc57bafcec5a15f74dc /gittutorial.html
parentc4b18dd00515b271e8b4e4725ce0d19c4ca41636 (diff)
downloadgit-htmldocs-38ddcce0c19a8eedec7a98bd291f65b2127a82b9.tar.gz
Autogenerated HTML docs for v1.5.6.3-350-g6c11a
Diffstat (limited to 'gittutorial.html')
-rw-r--r--gittutorial.html52
1 files changed, 37 insertions, 15 deletions
diff --git a/gittutorial.html b/gittutorial.html
index b77223e5f..8651c5bc6 100644
--- a/gittutorial.html
+++ b/gittutorial.html
@@ -546,7 +546,7 @@ same machine, wants to contribute.</p></div>
<div class="para"><p>Bob begins with:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>$ git clone /home/alice/project myrepo</tt></pre>
+<pre><tt>bob$ git clone /home/alice/project myrepo</tt></pre>
</div></div>
<div class="para"><p>This creates a new directory "myrepo" containing a clone of Alice's
repository. The clone is on an equal footing with the original
@@ -555,15 +555,15 @@ project, possessing its own copy of the original project's history.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>(edit files)
-$ git commit -a
+bob$ git commit -a
(repeat as necessary)</tt></pre>
</div></div>
<div class="para"><p>When he's ready, he tells Alice to pull changes from the repository
at /home/bob/myrepo. She does this with:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>$ cd /home/alice/project
-$ git pull /home/bob/myrepo master</tt></pre>
+<pre><tt>alice$ cd /home/alice/project
+alice$ git pull /home/bob/myrepo master</tt></pre>
</div></div>
<div class="para"><p>This merges the changes from Bob's "master" branch into Alice's
current branch. If Alice has made her own changes in the meantime,
@@ -572,20 +572,42 @@ then she may need to manually fix any conflicts. (Note that the
is the default.)</p></div>
<div class="para"><p>The "pull" command thus performs two operations: it fetches changes
from a remote branch, then merges them into the current branch.</p></div>
+<div class="para"><p>Note that in general, Alice would want her local changes committed before
+initiating this "pull". If Bob's work conflicts with what Alice did since
+their histories forked, Alice will use her working tree and the index to
+resolve conflicts, and existing local changes will interfere with the
+conflict resolution process (git will still perform the fetch but will
+refuse to merge --- Alice will have to get rid of her local changes in
+some way and pull again when this happens).</p></div>
+<div class="para"><p>Alice can peek at what Bob did without merging first, using the "fetch"
+command; this allows Alice to inspect what Bob did, using a special
+symbol "FETCH_HEAD", in order to determine if he has anything worth
+pulling, like this:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>alice$ git fetch /home/bob/myrepo master
+alice$ git log -p ..FETCH_HEAD</tt></pre>
+</div></div>
+<div class="para"><p>This operation is safe even if Alice has uncommitted local changes.</p></div>
+<div class="para"><p>After inspecting what Bob did, if there is nothing urgent, Alice may
+decide to continue working without pulling from Bob. If Bob's history
+does have something Alice would immediately need, Alice may choose to
+stash her work-in-progress first, do a "pull", and then finally unstash
+her work-in-progress on top of the resulting history.</p></div>
<div class="para"><p>When you are working in a small closely knit group, it is not
unusual to interact with the same repository over and over
again. By defining <em>remote</em> repository shorthand, you can make
it easier:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>$ git remote add bob /home/bob/myrepo</tt></pre>
+<pre><tt>alice$ git remote add bob /home/bob/myrepo</tt></pre>
</div></div>
-<div class="para"><p>With this, Alice can perform the first operation alone using the
+<div class="para"><p>With this, Alice can perform the first part of the "pull" operation alone using the
<em>git-fetch</em> command without merging them with her own branch,
using:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>$ git fetch bob</tt></pre>
+<pre><tt>alice$ git fetch bob</tt></pre>
</div></div>
<div class="para"><p>Unlike the longhand form, when Alice fetches from Bob using a
remote repository shorthand set up with <em>git-remote</em>, what was
@@ -593,7 +615,7 @@ fetched is stored in a remote tracking branch, in this case
<tt>bob/master</tt>. So after this:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>$ git log -p master..bob/master</tt></pre>
+<pre><tt>alice$ git log -p master..bob/master</tt></pre>
</div></div>
<div class="para"><p>shows a list of all the changes that Bob made since he branched from
Alice's master branch.</p></div>
@@ -601,20 +623,20 @@ Alice's master branch.</p></div>
could merge the changes into her master branch:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>$ git merge bob/master</tt></pre>
+<pre><tt>alice$ git merge bob/master</tt></pre>
</div></div>
<div class="para"><p>This <tt>merge</tt> can also be done by <em>pulling from her own remote
tracking branch</em>, like this:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>$ git pull . remotes/bob/master</tt></pre>
+<pre><tt>alice$ git pull . remotes/bob/master</tt></pre>
</div></div>
<div class="para"><p>Note that git pull always merges into the current branch,
regardless of what else is given on the command line.</p></div>
<div class="para"><p>Later, Bob can update his repo with Alice's latest changes using</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>$ git pull</tt></pre>
+<pre><tt>bob$ git pull</tt></pre>
</div></div>
<div class="para"><p>Note that he doesn't need to give the path to Alice's repository;
when Bob cloned Alice's repository, git stored the location of her
@@ -622,7 +644,7 @@ repository in the repository configuration, and that location is
used for pulls:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>$ git config --get remote.origin.url
+<pre><tt>bob$ git config --get remote.origin.url
/home/alice/project</tt></pre>
</div></div>
<div class="para"><p>(The complete configuration created by <em>git-clone</em> is visible using
@@ -632,14 +654,14 @@ explains the meaning of each option.)</p></div>
name "origin/master":</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>$ git branch -r
+<pre><tt>bob$ git branch -r
origin/master</tt></pre>
</div></div>
<div class="para"><p>If Bob later decides to work from a different host, he can still
perform clones and pulls using the ssh protocol:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>$ git clone alice.org:/home/alice/project myrepo</tt></pre>
+<pre><tt>bob$ git clone alice.org:/home/alice/project myrepo</tt></pre>
</div></div>
<div class="para"><p>Alternatively, git has a native protocol, or can use rsync or http;
see <a href="git-pull.html">git-pull(1)</a> for details.</p></div>
@@ -859,7 +881,7 @@ digressions that may be interesting at this point are:</p></div>
</div>
<div id="footer">
<div id="footer-text">
-Last updated 2008-07-06 05:17:11 UTC
+Last updated 2008-07-15 15:48:35 UTC
</div>
</div>
</body>