{"thread":{"id":"2356","subject":"[PATCH] Added a few examples to git-pull man page.","startedAt":"2005-11-05T02:36:08Z","lastAt":"2005-11-05T19:37:12Z","messageCount":3,"participants":["Jon Loeliger","Junio C Hamano","Josef Weidendorfer"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"11165","messageId":"E1EYDua-00017o-9d@jdl.com","threadId":"2356","inReplyTo":null,"subject":"[PATCH] Added a few examples to git-pull man page.","fromName":"Jon Loeliger","fromEmail":"jdl@freescale.com","sentAt":"2005-11-05T02:36:08Z","receivedAt":"2005-11-05T02:36:08Z","isPatch":true,"sender":{"key":"jdl@jdl.com","avatar":"https://gravatar.com/avatar/75ce9a10b151acd2c28ec4ab2136dba7b2ff1634530bd04b155981a749d08a64?d=mp&s=160"},"body":"Added a few examples to git-pull man page.\nClarified and added notes for pull/push refspecs.\nConverted to back-ticks for literal text examples.\n\nSigned-off-by: Jon Loeliger <jdl@freescale.com>\n---\n\nHmmm.  Are back-ticks the standard for literal text examples?\n\n\n\n\n Documentation/git-pull.txt         |   55 ++++++++++++++++++++++++++--\n Documentation/pull-fetch-param.txt |   72 +++++++++++++++++++++++++-----------\n 2 files changed, 101 insertions(+), 26 deletions(-)\n\napplies-to: a469bc3e7efcb96db78bbffcdabcbea01bead34d\nca90ebc23d3e6fb73bc7da3e3d893adab8456722\ndiff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt\nindex cef4c0a..8f37d53 100644\n--- a/Documentation/git-pull.txt\n+++ b/Documentation/git-pull.txt\n@@ -19,7 +19,7 @@ When only one ref is downloaded, runs 'g\n into the local HEAD.  Otherwise uses 'git octopus' to merge them\n into the local HEAD.\n \n-Note that you can use '.' (current directory) as the\n+Note that you can use `.` (current directory) as the\n <repository> to pull from the local repository -- this is useful\n when merging local branches into the current branch.\n \n@@ -29,8 +29,57 @@ include::pull-fetch-param.txt[]\n \n -a, \\--append::\n \tAppend ref names and object names of fetched refs to the\n-\texisting contents of $GIT_DIR/FETCH_HEAD.  Without this\n-\toption old data in $GIT_DIR/FETCH_HEAD will be overwritten.\n+\texisting contents of `$GIT_DIR/FETCH_HEAD`.  Without this\n+\toption old data in `$GIT_DIR/FETCH_HEAD` will be overwritten.\n+\n+Examples\n+--------\n+Command line pull of multiple branches from one repository::\n++\n+------------------------------------------------\n+$ cat .git/remotes/origin\n+URL: rsync://rsync.kernel.org/pub/scm/git/git.git\n+Pull: master:origin\n+\n+$ git checkout master\n+$ git fetch origin master:origin +pu:pu maint:maint\n+$ git pull . origin\n+------------------------------------------------\n++\n+Here, a typical `$GIT_DIR/remotes/origin` file from a\n+`git-clone` operation is used in combination with\n+command line options to `git-fetch` to first update\n+multiple branches of the local repository and then\n+to merge the remote `origin` branch into the local\n+`master` branch.  The local `pu` branch is updated\n+even if it does not result in a fast forward update.\n+Here, the pull can obtain its objects from the local\n+repository using `.`, as the previous `git-fetch` is\n+known to have already obtained and made available\n+all the necessary objects.\n+\n+\n+Pull of multiple branches from one repository using `$GIT_DIR/remotes` file::\n++\n+------------------------------------------------\n+$ cat .git/remotes/origin\n+URL: rsync://rsync.kernel.org/pub/scm/git/git.git\n+Pull: master:origin\n+Pull: +pu:pu\n+Pull: maint:maint\n+\n+$ git checkout master\n+$ git pull origin\n+------------------------------------------------\n++\n+Here, a typical `$GIT_DIR/remotes/origin` file from a\n+`git-clone` operation has been hand-modified to include\n+the branch-mapping of additional remote and local\n+heads directly.  A single `git-pull` operation while\n+in the `master` branch will fetch multiple heads and\n+merge the remote `origin` head into the current,\n+local `master` branch.\n+\n \n Author\n ------\ndiff --git a/Documentation/pull-fetch-param.txt b/Documentation/pull-fetch-param.txt\nindex e8db9d7..2a71318 100644\n--- a/Documentation/pull-fetch-param.txt\n+++ b/Documentation/pull-fetch-param.txt\n@@ -1,7 +1,8 @@\n <repository>::\n-\tThe \"remote\" repository to pull from.  One of the\n-\tfollowing notations can be used to name the repository\n-\tto pull from:\n+\tThe \"remote\" repository that is the source of a fetch\n+\tor pull operation, or the destination of a push operation.\n+\tOne of the following notations can be used\n+\tto name the remote repository:\n +\n ===============================================================\n - Rsync URL:\t\trsync://remote.machine/path/to/repo.git/\n@@ -12,7 +13,7 @@\n ===============================================================\n +\n In addition to the above, as a short-hand, the name of a\n-file in $GIT_DIR/remotes directory can be given; the\n+file in `$GIT_DIR/remotes` directory can be given; the\n named file should be in the following format:\n +\n \tURL: one of the above URL format\n@@ -21,57 +22,82 @@ named file should be in the following fo\n +\n When such a short-hand is specified in place of\n <repository> without <refspec> parameters on the command\n-line, <refspec>... specified on Push lines or Pull lines\n-are used for \"git push\" and \"git fetch/pull\",\n-respectively.\n+line, <refspec>... specified on `Push:` lines or `Pull:`\n+lines are used for `git-push` and `git-fetch`/`git-pull`,\n+respectively.  Multiple `Push:` and and `Pull:` lines may\n+be specified for additional branch mappings.\n +\n-The name of a file in $GIT_DIR/branches directory can be\n+The name of a file in `$GIT_DIR/branches` directory can be\n specified as an older notation short-hand; the named\n file should contain a single line, a URL in one of the\n-above formats, optionally followed by a hash '#' and the\n+above formats, optionally followed by a hash `#` and the\n name of remote head (URL fragment notation).\n-$GIT_DIR/branches/<remote> file that stores a <url>\n+`$GIT_DIR/branches/<remote>` file that stores a <url>\n without the fragment is equivalent to have this in the\n-corresponding file in the $GIT_DIR/remotes/ directory\n+corresponding file in the `$GIT_DIR/remotes/` directory.\n +\n \tURL: <url>\n \tPull: refs/heads/master:<remote>\n +\n-while having <url>#<head> is equivalent to\n+while having `<url>#<head>` is equivalent to\n +\n \tURL: <url>\n \tPull: refs/heads/<head>:<remote>\n \n <refspec>::\n \tThe canonical format of a <refspec> parameter is\n-\t'+?<src>:<dst>'; that is, an optional plus '+', followed\n-\tby the source ref, followed by a colon ':', followed by\n+\t`+?<src>:<dst>`; that is, an optional plus `+`, followed\n+\tby the source ref, followed by a colon `:`, followed by\n \tthe destination ref.\n +\n-When used in \"git push\", the <src> side can be an\n+When used in `git-push`, the <src> side can be an\n arbitrary \"SHA1 expression\" that can be used as an\n-argument to \"git-cat-file -t\".  E.g. \"master~4\" (push\n+argument to `git-cat-file -t`.  E.g. `master~4` (push\n four parents before the current master head).\n +\n-For \"git push\", the local ref that matches <src> is used\n+For `git-push`, the local ref that matches <src> is used\n to fast forward the remote ref that matches <dst>.  If\n-the optional plus '+' is used, the remote ref is updated\n+the optional plus `+` is used, the remote ref is updated\n even if it does not result in a fast forward update.\n +\n-For \"git fetch/pull\", the remote ref that matches <src>\n+For `git-fetch` and `git-pull`, the remote ref that matches <src>\n is fetched, and if <dst> is not empty string, the local\n ref that matches it is fast forwarded using <src>.\n-Again, if the optional plus '+' is used, the local ref\n+Again, if the optional plus `+` is used, the local ref\n is updated even if it does not result in a fast forward\n update.\n +\n+[NOTE]\n+If the remote branch from which you want to pull is\n+modified in non-linear ways such as being rewound and\n+rebased frequently, then a pull will attempt a merge with\n+an older version of itself, likely conflict, and fail.\n+It is under these conditions that you would want to use\n+the `+` sign to indicate non-fast-forward updates will\n+be needed.  There is currently no easy way to determine\n+or declare that a branch will be made available in a\n+repository with this behavior; the pulling user simply\n+must know this is the expected usage pattern for a branch.\n++\n+[NOTE]\n+You never do your own development on branches that appear\n+on the right hand side of a <refspec> colon on `Pull:` lines;\n+they are to be updated by `git-fetch`.  The corollary is that\n+a local branch should be introduced and named on a <refspec>\n+right-hand-side if you intend to do development derived from\n+that branch.\n+This leads to the common `Pull: master:origin` mapping of a\n+remote `master` branch to a local `origin` branch, which\n+is then merged to a local development branch, again typically\n+named `master`.\n++\n Some short-cut notations are also supported.\n +\n-* For backward compatibility, \"tag\" is almost ignored;\n+* For backward compatibility, `tag` is almost ignored;\n   it just makes the following parameter <tag> to mean a\n-  refspec \"refs/tags/<tag>:refs/tags/<tag>\".\n+  refspec `refs/tags/<tag>:refs/tags/<tag>`.\n * A parameter <ref> without a colon is equivalent to\n-  <ref>: when pulling/fetching, and <ref>:<ref> when\n+  <ref>: when pulling/fetching, and <ref>`:`<ref> when\n   pushing.  That is, do not store it locally if\n   fetching, and update the same name if pushing.\n \n---\n0.99.9.GIT\n"},{"id":"11167","messageId":"7vk6fno36c.fsf@assigned-by-dhcp.cox.net","threadId":"2356","inReplyTo":"E1EYDua-00017o-9d@jdl.com","subject":"Re: [PATCH] Added a few examples to git-pull man page.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-05T09:27:07Z","receivedAt":"2005-11-05T09:27:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks for the documentation updates.  I have one\ntrouble about this part:\n\n    You never do your own development on branches that appear\n    on the right hand side of a <refspec> colon on `Pull:` lines;\n    they are to be updated by `git-fetch`.  The corollary is that\n    a local branch should be introduced and named on a <refspec>\n    right-hand-side if you intend to do development derived from\n    that branch.\n    This leads to the common `Pull: master:origin` mapping of a\n    remote `master` branch to a local `origin` branch, which\n    is then merged to a local development branch, again typically\n    named `master`.\n\nI am a bit confused by the \"corollary\".  What happens if you\nhave the following:\n\n\tPull: master:origin\n        Pull: +pu:pu\n        Pull: maint:maint\n\nand you say:\n\n\tgit-pull remote\n\nwhen you are on your master branch is:\n\n1. master, pu and maint from remote are copied to origin, pu,\n   and maint in the local repository (you already know this);\n\n2. the updated origin is merged into the local master (you\n   alerady know this too).\n\nIf somebody intends to do development derived from say 'maint',\none way to do so would be something like this:\n\n\tgit checkout -b my-maint maint\n\t.. work work work, commit commit commit\n        .. \"git-format-patch maint..my-maint\" to send patches\n\t.. off, or send a pull request to upstream.\n        git fetch remote ;# to update origin, pu, and maint.\n        git pull . maint ;# merge maint changes into my-maint.\n\nThat is, my-maint branch is used for your own development, and\nfrom time to time you fetch remote heads (using remotes/remote\nshorthands, the fetch would update origin, pu and maint) to keep\ntrack of the progress of the upstream.  And you merge upstream\n'maint' into your development line 'my-maint', when you find\nthat the upstream have something new in 'maint'.\n\nAnd because of the rule \"you never do your own development on RHS\nbranch\":\n\n\tgit checkout maint\n        .. work work work, commit commit commit\n        git pull remote ;# oops\n\nthis is discouraged.  'git pull remote' would try to overwrite\nthe local 'maint' with the remote 'maint', and it would find\nthat the head would not fast-forward (obviously, since we did\nour own work that the remote side does not know about).  But\nwhen I read the \"corollary\" the first time, it appeared to me\nthat we are suggesting the above.\n\nMaybe something like this (I know my wording is quite bad and I\nwould appreciate rephrasing it better very much) would be more\nexplicit and appropriate?\n\n    If you intend to do development derived from a remote\n    branch B, have a `Pull:` line to track it, like this:\n\n        Pull: B:remote-B\n\n    and have a separate branch my-B to do your development\n    on top of it.  The latter is created by 'git branch my-B\n    remote-B' (or its equivalent, 'git checkout -b my-B\n    remote-B'), and that is the branch you make your own\n    commits.  Run 'git fetch' to keep track of the progress\n    of the remote side, and when you see the tracked remote\n    branch has something new, merge it into your development\n    branch with 'git pull . remote-B', while you are on my-B\n    branch.\n"},{"id":"11170","messageId":"200511052037.12410.Josef.Weidendorfer@gmx.de","threadId":"2356","inReplyTo":"7vk6fno36c.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Added a few examples to git-pull man page.","fromName":"Josef Weidendorfer","fromEmail":"josef.weidendorfer@gmx.de","sentAt":"2005-11-05T19:37:12Z","receivedAt":"2005-11-05T19:37:12Z","isPatch":true,"sender":{"key":"josef.weidendorfer@gmx.de","avatar":null},"body":"On Saturday 05 November 2005 10:27, Junio C Hamano wrote:\n> Maybe something like this (I know my wording is quite bad and I\n> would appreciate rephrasing it better very much) would be more\n> explicit and appropriate?\n> \n>     If you intend to do development derived from a remote\n>     branch B, have a `Pull:` line to track it, like this:\n> \n>         Pull: B:remote-B\n> \n>     and have a separate branch my-B to do your development\n>     on top of it.  The latter is created by 'git branch my-B\n>     remote-B' (or its equivalent, 'git checkout -b my-B\n>     remote-B'), and that is the branch you make your own\n>     commits.  Run 'git fetch' to keep track of the progress\n>     of the remote side, and when you see the tracked remote\n>     branch has something new, merge it into your development\n>     branch with 'git pull . remote-B', while you are on my-B\n>     branch.\n\nIt would be good to explicitly mention that exactly this is\nalready setup for you after cloning: you are prepared to do\nlocal development based on the remote \"master\", with\n\t- remote head \"B\" = remote head \"master\"\n\t- local head \"remote-B\" = local head \"origin\"\n\t- local head \"my-B\" = local head \"master\"\n\nHmm. I just looked up the manual page of \"git-clone\", but it\ndoes not mention this. It also should say that all remote heads\nare cloned to local heads with the same name, with one exception:\nremote \"master\" matches local \"origin\".\n\nThis feels really inconsistent. Junio, I think your proposal of\ntracking remote \"B\" with local \"origin/B\" is a lot better. It\nallows to name a local development branch for any remote \"B\" by\nthe same local name \"B\".\n\nWe could make heads starting with \"origin/\" special: Never let\n\"git commit\" update such a head, but give out a warning instead,\nthat this head should not be changed locally, as it is used for\ntracking a remote head. This warning could suggest to do \"git branch\"\nbefore committing.\nThis special handling (of \"origin/\") should not be hardcoded, but\nconfigurable, perhaps in .git/remotes:\n\n\tURL: remote-URL\n\tPrefix: origin/\n\nJosef\n"}]}