git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Git-pull Documentation
@ 2019-02-13 18:13 Maris Razvan
  2019-02-13 22:43 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Maris Razvan @ 2019-02-13 18:13 UTC (permalink / raw)
  To: git

Hello,

In the "EXAMPLES" section of the git-pull documentation
(https://git-scm.com/docs/git-pull#_examples) there is the following:

    "[...] Merge into the current branch the remote branch next:

    $ git pull origin next

    This leaves a copy of next temporarily in FETCH_HEAD, but does not
update any remote-
    tracking branches. [...]"

However, the second bullet-point in the "CONFIGURED REMOTE-TRACKING
BRANCHES" section of the git-fetch documentation
(https://git-scm.com/docs/git-fetch#_configured_remote_tracking_branches_a_id_crtb_a)
states that it is possible for a command of the form "git fetch
<remote> <branch>" to update a remote-tracking branch.

I checked and the current behaviour of "git pull <remote> <branch>" is
to update the remote-tracking branch if required, because, as I have
seen in the code, it just calls "git fetch".

I believe that the quoted example from the git-pull documentation is wrong.

Also, in the beginning of the git-pull documentation there is the
following paragraph:

    "Default values for <repository> and <branch> are read from the
"remote" and "merge"
    configuration for the current branch as set by git-branch[1] --track."

I believe that this paragraph tries to state that if the <remote> and
the <refspec> arguments are missing, they are replaced with
branch.<name>.remote and branch.<name>.merge, respectively. However I
think that this paragraph is unnecessary (and partially wrong), as the
behaviour of git-pull when no arguments are given is described in the
"DEFAULT BEHAVIOUR" section
(https://git-scm.com/docs/git-pull#_default_behaviour) and it is a
little more complicated than that, as one set of branches are used for
fetching (e.g. the values of remote.<origin>.fetch) and another set of
branches are used for merging (e.g. the value of branch.<name>.merge).


I hope I did not miss anything.


Thank you,
Razvan Maris

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Git-pull Documentation
  2019-02-13 18:13 Git-pull Documentation Maris Razvan
@ 2019-02-13 22:43 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2019-02-13 22:43 UTC (permalink / raw)
  To: Maris Razvan; +Cc: git

Maris Razvan <razvan.alex.maris@gmail.com> writes:

> I checked and the current behaviour of "git pull <remote> <branch>" is
> to update the remote-tracking branch if required, because, as I have
> seen in the code, it just calls "git fetch".

The thing is, "git fetch origin next" did *NOT* update remote-tracking
branch refs/remotes/origin/next for a long time, until f2690487
("fetch: opportunistically update tracking refs", 2013-05-11)
happend.

The series did not update the documentation all that much, which was
why you are seeing neither "git fetch" nor "git pull" documented to
perform this "opportunistic update of tracking refs".  The only
change the topic with f2690487 brought in to the Documentation was
the attached bit.

Documentation updates to both pull and fetch are very much welcomed.

Thanks.

$ git diff --stat -p 67b57a90f4 db400949b31a Documentation/
 Documentation/pull-fetch-param.txt | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/Documentation/pull-fetch-param.txt b/Documentation/pull-fetch-param.txt
index 94a9d32f1d..18cffc25b8 100644
--- a/Documentation/pull-fetch-param.txt
+++ b/Documentation/pull-fetch-param.txt
@@ -68,6 +68,11 @@ Some short-cut notations are also supported.
 +
 * `tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`;
   it requests fetching everything up to the given tag.
-* A parameter <ref> without a colon is equivalent to
-  <ref>: when pulling/fetching, so it merges <ref> into the current
-  branch without storing the remote branch anywhere locally
+ifndef::git-pull[]
+* A parameter <ref> without a colon fetches that ref into FETCH_HEAD,
+endif::git-pull[]
+ifdef::git-pull[]
+* A parameter <ref> without a colon merges <ref> into the current
+  branch,
+endif::git-pull[]
+  and updates the remote-tracking branches (if any).




^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-13 22:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-13 18:13 Git-pull Documentation Maris Razvan
2019-02-13 22:43 ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).