tutorial: shorthand for remotes but show distributed nature of git
* Promiscous pull shows the distributed nature of git better. * Add a new step after that to teach "remote add". * Highlight that with the shorthand defined you will get remote tracking branches for free. * Fix Alice's workflow. Signed-off-by: Santi Béjar <sbejar@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Jan 17, 2007 at 01:10 UTC
c1ff284a702c487e4a6f4966b69adff83cd5cf37
1 file changed
+24
-19
Documentation/tutorial.txt
+24
-19
@@ -283,12 +283,10 @@ at /home/bob/myrepo. She does this with:
283
284
------------------------------------------------
285
$ cd /home/alice/project
286
-$ git remote add bob /home/bob/myrepo
287
-$ git pull bob master
286
+$ git pull /home/bob/myrepo master
287
------------------------------------------------
288
290
-First it adds the "remote" Bob's repository with the name "bob" and
291
-then it merges the changes from Bob's "master" branch into Alice's
289
+This merges the changes from Bob's "master" branch into Alice's
290
current branch. If Alice has made her own changes in the meantime,
291
then she may need to manually fix any conflicts. (Note that the
292
"master" argument in the above command is actually unnecessary, as it
@@ -297,14 +295,27 @@ is the default.)
295
The "pull" command thus performs two operations: it fetches changes
296
from a remote branch, then merges them into the current branch.
297
300
-You can perform the first operation alone using the "git fetch"
301
-command without merging them with her own branch, using:
298
+When you are working in a small closely knit group, it is not
299
+unusual to interact with the same repository over and over
300
+again. By defining 'remote' repository shorthand, you can make
301
+it easier:
302
+
303
+------------------------------------------------
304
+$ git remote add bob /home/bob/myrepo
305
+------------------------------------------------
306
+
307
+With this, you can perform the first operation alone using the
308
+"git fetch" command without merging them with her own branch,
309
+using:
310
311
-------------------------------------
312
$ git fetch bob
313
-------------------------------------
314
307
-which fetches the changes from Bob's branches. Then
315
+Unlike the longhand form, when Alice fetches from Bob using a
316
+remote repository shorthand set up with `git remote`, what was
317
+fetched is stored in a remote tracking branch, in this case
318
+`bob/master`. So after this:
319
320
-------------------------------------
321
$ git log -p master..bob/master
@@ -313,28 +324,22 @@ $ git log -p master..bob/master
324
shows a list of all the changes that Bob made since he branched from
325
Alice's master branch.
326
316
-After examining those changes, and possibly fixing things, Alice
327
+After examining those changes, Alice
328
could merge the changes into her master branch:
329
330
-------------------------------------
320
-$ git checkout master
331
$ git merge bob/master
332
-------------------------------------
333
324
-The last command is a merge of the "bob/master" branch in Alice's
325
-own repository.
326
-
327
-Alice could also perform both steps at once with:
334
+This `merge` can also be done by 'pulling from her own remote
335
+tracking branch', like this:
336
337
-------------------------------------
330
-$ git pull bob
338
+$ git pull . remotes/bob/master
339
-------------------------------------
340
333
-This is just like the "git pull bob master" that we saw
334
-before, except that it also stores the unmerged changes from bob's
335
-master branch in bob/master before merging them into Alice's
336
-current branch. Note that git pull always merges into the current
337
-branch, regardless of what else is given on the commandline.
341
+Note that git pull always merges into the current branch,
342
+regardless of what else is given on the commandline.
343
344
Later, Bob can update his repo with Alice's latest changes using
345