Correct git-pull documentation
PATCH 1/1 Correct git-pull documentation
The --rebase option was documented in the wrong place (under MERGE STRATEGIES instead of OPTIONS). Noted the branch.<name>.rebase option and clarified the use '.' in a few places. Switched "git-<command>" to "git command".
--- Documentation/git-pull.txt | 38 ++++++++++++++++++++++---------------- 1 files changed, 22 insertions(+), 16 deletions(-)
Documentation/git-pull.txt +22 -16
@@ -8,13 +8,14 @@ git-pull - Fetch from and merge with another repository or a local branch SYNOPSIS -------- -'git-pull' <options> <repository> <refspec>... +'git-pull' [<options>] [<repository>] [<refspec>...] DESCRIPTION ----------- -Runs `git-fetch` with the given parameters, and calls `git-merge` -to merge the retrieved head(s) into the current branch. +Runs `git fetch` with the given parameters, and calls `git merge` or +`git rebase` to merge or rebase the retrieved head(s) into the +current branch. Note that you can use `.` (current directory) as the <repository> to pull from the local repository -- this is useful
@@ -28,17 +29,12 @@ include::merge-options.txt[] :git-pull: 1 include::fetch-options.txt[] -include::pull-fetch-param.txt[] - -include::urls-remotes.txt[] - -include::merge-strategies.txt[] - \--rebase:: Instead of a merge, perform a rebase after fetching. If there is a remote ref for the upstream branch, and this branch was rebased since last fetched, the rebase uses that information - to avoid rebasing non-local changes. + to avoid rebasing non-local changes. This if the default if + `branch.<name>.rebase` is set. + *NOTE:* This is a potentially _dangerous_ mode of operation. It rewrites history, which does not bode well when you
@@ -48,6 +44,12 @@ unless you have read linkgit:git-rebase[1] carefully. \--no-rebase:: Override earlier \--rebase. +include::pull-fetch-param.txt[] + +include::urls-remotes.txt[] + +include::merge-strategies.txt[] + DEFAULT BEHAVIOUR -----------------
@@ -55,12 +57,13 @@ Often people use `git pull` without giving any parameter. Traditionally, this has been equivalent to saying `git pull origin`. However, when configuration `branch.<name>.remote` is present while on branch `<name>`, that value is used instead of -`origin`. +`origin`. (`branch.<name>.remote` may be set to `.` to pull from +the local repository by default.) -In order to determine what URL to use to fetch from, the value -of the configuration `remote.<origin>.url` is consulted -and if there is not any such variable, the value on `URL: ` line -in `$GIT_DIR/remotes/<origin>` file is used. +Unless pulling from the local repository, a URL must be determined +for the origin. This is done by first consulting +`remote.<origin>.url`. If there is not any such variable, the value +on `URL: ` line in `$GIT_DIR/remotes/<origin>` file is used. In order to determine what remote branches to fetch (and optionally store in the tracking branches) when the command is
@@ -138,6 +141,9 @@ You should refrain from abusing this option to sneak substantial changes into a merge commit. Small fixups like bumping release/version name would be acceptable. +git pull --rebase . master:: + This syntax is equivalent to calling `git rebase master`; see + linkgit:git-rebase[1] for details. Command line pull of multiple branches from one repository:: + ------------------------------------------------
@@ -163,7 +169,7 @@ linkgit:git-reset[1]. SEE ALSO -------- -linkgit:git-fetch[1], linkgit:git-merge[1], linkgit:git-config[1] +linkgit:git-fetch[1], linkgit:git-merge[1], linkgit:git-config[1], linkgit:git-rebase[1] Author
Signature · 1 line
1.5.4.1.1281.g75df
Quoted 5 lines · Jay Soffian
Documentation/git-pull.txt +0
-0
...
Quoted 7 lines
Documentation/git-pull.txt +0
-3@@ -28,17 +29,12 @@ include::merge-options.txt[] :git-pull: 1 include::fetch-options.txt[] -include::pull-fetch-param.txt[] - -include::urls-remotes.txt[]
Documentation/git-pull.txt include::merge-options.txt[] · line 37
Quoted 10 lines
Documentation/git-pull.txt +1
-4- -include::merge-strategies.txt[] - \--rebase:: Instead of a merge, perform a rebase after fetching. If there is a remote ref for the upstream branch, and this branch was rebased since last fetched, the rebase uses that information - to avoid rebasing non-local changes. + to avoid rebasing non-local changes. This if the default if
... This *is* the default if
Quoted 5 lines
Documentation/git-pull.txt +1
-0+ `branch.<name>.rebase` is set. + *NOTE:* This is a potentially _dangerous_ mode of operation.It rewrites history, which does not bode well when you
Signature · 1 line
-jul-
Quoted 4 lines · Jay Soffian
The --rebase option was documented in the wrong place (under MERGE STRATEGIES instead of OPTIONS). Noted the branch.<name>.rebase option and clarified the use '.' in a few places. Switched "git-<command>" to "git command".
Clarifying that --rebase is not a strategy is a good improvement. Thanks.
Documentation/git-pull.txt Often people use `git pull` without giving any parameter. · line 61
Quoted 7 lines
Documentation/git-pull.txt +2
-1@@ -55,12 +57,13 @@ Often people use `git pull` without giving any parameter. Traditionally, this has been equivalent to saying `git pull origin`. However, when configuration `branch.<name>.remote` is present while on branch `<name>`, that value is used instead of -`origin`. +`origin`. (`branch.<name>.remote` may be set to `.` to pull from +the local repository by default.)
I am not sure if this special case deserves mentioning here.
Documentation/git-pull.txt Often people use `git pull` without giving any parameter. · line 66
Quoted 8 lines
Documentation/git-pull.txt +4
-4-In order to determine what URL to use to fetch from, the value -of the configuration `remote.<origin>.url` is consulted -and if there is not any such variable, the value on `URL: ` line -in `$GIT_DIR/remotes/<origin>` file is used. +Unless pulling from the local repository, a URL must be determined +for the origin. This is done by first consulting +`remote.<origin>.url`. If there is not any such variable, the value +on `URL: ` line in `$GIT_DIR/remotes/<origin>` file is used.
Likewise.
Documentation/git-pull.txt You should refrain from abusing this option to sneak substantial · line 146
Quoted 7 lines
Documentation/git-pull.txt +3
-0@@ -138,6 +141,9 @@ You should refrain from abusing this option to sneak substantial changes into a merge commit. Small fixups like bumping release/version name would be acceptable. +git pull --rebase . master:: + This syntax is equivalent to calling `git rebase master`; see + linkgit:git-rebase[1] for details.
Likewise. That is a very roundabout way to say "git rebase master". It happens to work as a logical consequence of two facts (1) that you can pull from any remote and (2) that "." is a valid remote that names local. I am personally happy that the command works consistently, but I think we should rather teach people the more natural way to do their rebase in our documentation.
The fact that we earlier talked about "git pull ." does not justify this addition. Even though "git pull ." is also a roundabout way, it used to be the only way (we did not have the "git merge" callable as the top-level command) and there are existing documents that show the "git pull ." form out there on the web, and that is the primary reason we mention this ancient form, so that people who saw such an ancient notation can find out what it is about in our documentation. Some people still prefer it from pure inertia, and we have no reason to deprecate it, but I do not think it is something we should advertise as the first class interface.
Quoted 10 lines · Junio C Hamano
Quoted 4 lines · Jay Soffian
The --rebase option was documented in the wrong place (under MERGE STRATEGIES instead of OPTIONS). Noted the branch.<name>.rebase option and clarified the use '.' in a few places. Switched "git-<command>" to "git command".
Clarifying that --rebase is not a strategy is a good improvement. Thanks.
Quoted 9 lines
Documentation/git-pull.txt Often people use `git pull` without giving any parameter. · line 61
Quoted 7 lines
Documentation/git-pull.txt +2
-1@@ -55,12 +57,13 @@ Often people use `git pull` without giving any parameter. Traditionally, this has been equivalent to saying `git pull origin`. However, when configuration `branch.<name>.remote` is present while on branch `<name>`, that value is used instead of -`origin`. +`origin`. (`branch.<name>.remote` may be set to `.` to pull from +the local repository by default.)I am not sure if this special case deserves mentioning here.
Sigh, this is getting a bit frustrating. Yes you can use "fetch + merge" or "fetch + rebase", but what I'm trying to get at here is that if the user configures their branch appropriately, they can just use "git pull" and it will just Do The Right Thing. But for that to work, the user has to know to set branch.<name>.remote to "." and the git-pull documentation seems like the right place to mention it.
Quoted 10 lines
Documentation/git-pull.txt Often people use `git pull` without giving any parameter. · line 66
Quoted 8 lines
Documentation/git-pull.txt +4
-4-In order to determine what URL to use to fetch from, the value -of the configuration `remote.<origin>.url` is consulted -and if there is not any such variable, the value on `URL: ` line -in `$GIT_DIR/remotes/<origin>` file is used. +Unless pulling from the local repository, a URL must be determined +for the origin. This is done by first consulting +`remote.<origin>.url`. If there is not any such variable, the value +on `URL: ` line in `$GIT_DIR/remotes/<origin>` file is used.Likewise.
Likewise what? All I did was clarify the existing paragraph which was wrong in the case where remote is set to "."
Quoted 16 lines
Documentation/git-pull.txt You should refrain from abusing this option to sneak substantial · line 146
Quoted 7 lines
Documentation/git-pull.txt +3
-0@@ -138,6 +141,9 @@ You should refrain from abusing this option to sneak substantial changes into a merge commit. Small fixups like bumping release/version name would be acceptable. +git pull --rebase . master:: + This syntax is equivalent to calling `git rebase master`; see + linkgit:git-rebase[1] for details.Likewise. That is a very roundabout way to say "git rebase master". It happens to work as a logical consequence of two facts (1) that you can pull from any remote and (2) that "." is a valid remote that names local. I am personally happy that the command works consistently, but I think we should rather teach people the more natural way to do their rebase in our documentation.
Quoted 11 lines
The fact that we earlier talked about "git pull ." does not justify this addition. Even though "git pull ." is also a roundabout way, it used to be the only way (we did not have the "git merge" callable as the top-level command) and there are existing documents that show the "git pull ." form out there on the web, and that is the primary reason we mention this ancient form, so that people who saw such an ancient notation can find out what it is about in our documentation. Some people still prefer it from pure inertia, and we have no reason to deprecate it, but I do not think it is something we should advertise as the first class interface.
I want to be able to use "git pull" (w/o any options) and have it figure out based on my configuration what to do with the current branch, be it:
1. merge another local branch.
1. rebase from another local branch.
3. fetch+merge from remote.
4. fetch+rebase from remote.
And in fact, I can. But to do so, I have to know that "." means local, so why not advertise that fact in git-pull?
j.
PATCH 1/1 Correct git-pull documentation
In reply to Jay SoffianThe --rebase option was documented in the wrong place (under MERGE STRATEGIES instead of OPTIONS). Noted the branch.<name>.rebase option.
--- Documentation/git-pull.txt | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-)
Documentation/git-pull.txt +12 -8
@@ -15,6 +15,7 @@ DESCRIPTION ----------- Runs `git-fetch` with the given parameters, and calls `git-merge` to merge the retrieved head(s) into the current branch. +With `--rebase`, calls `git-rebase` instead of `git-merge`. Note that you can use `.` (current directory) as the <repository> to pull from the local repository -- this is useful
@@ -26,19 +27,14 @@ OPTIONS include::merge-options.txt[] :git-pull: 1 -include::fetch-options.txt[] - -include::pull-fetch-param.txt[] - -include::urls-remotes.txt[] - -include::merge-strategies.txt[] \--rebase:: Instead of a merge, perform a rebase after fetching. If there is a remote ref for the upstream branch, and this branch was rebased since last fetched, the rebase uses that information - to avoid rebasing non-local changes. + to avoid rebasing non-local changes. To make this the default + for branch `<name>`, set configuration `branch.<name>.rebase` + to `true`. + *NOTE:* This is a potentially _dangerous_ mode of operation. It rewrites history, which does not bode well when you
@@ -48,6 +44,14 @@ unless you have read linkgit:git-rebase[1] carefully. \--no-rebase:: Override earlier \--rebase. +include::fetch-options.txt[] + +include::pull-fetch-param.txt[] + +include::urls-remotes.txt[] + +include::merge-strategies.txt[] + DEFAULT BEHAVIOUR -----------------
Signature · 1 line
1.5.4.2.204.gbea87