threads / patch / 64194

patch, 4 partsdoc: git-pull: clarify DESCRIPTION section

Subject: [PATCH 0/4] doc: git-pull: clarify DESCRIPTION section

## tl;dr

32 messages between Sep 23, 2025 and Oct 15, 2025. Diffs are folded; open one to read it.

replies: 31people: 5as markdown or json

Julia Evans via GitGitGadget· Sep 23, 2025, 19:44 UTC · lore

I got feedback from 15 Git users on the current git pull man page, using this tool: https://text-feedback.wizardzines.com/git-pull.

My goals here are to be clear about the relationship between git pull and fetch/merge/rebase etc, make sure users know the current default for git pull (--ff-only) since some folks still remember the old default, and to help users quickly figure out what command they need to run to merge/rebase/squash/etc.

I've taken a pretty aggressive approach because I think it's possible to have a pretty short and focused DESCRIPTION section here while keeping the most important info. Open to hearing that I've removed too much.

This references the UPSTREAM BRANCHES section from https://lore.kernel.org/git/0ec629d4037bf5d1ccc248ca1bbd87ccc08119a3.1757703309.git.gitgitgadget@gmail.com/ , so if that isn't merged I'll need to revisit the approach here.

Julia Evans (4):
  doc: git-pull: move <repository> and <refspec> params
  doc: git-pull: clarify options for integrating remote branch
  doc: git-pull: delete the example
  doc: git-pull: clarify how to exit a conflicted merge
 Documentation/git-pull.adoc | 86 ++++++++++++++-----------------------
 1 file changed, 32 insertions(+), 54 deletions(-)
base-commit: ca2559c1d630eb4f04cdee2328aaf1c768907a9e
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1976%2Fjvns%2Fclarify-pull-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1976/jvns/clarify-pull-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1976
-- 
gitgitgadget
Julia Evans via GitGitGadget· Sep 23, 2025, 19:44 UTC · re: Julia Evans via GitGitGadget · lore

[PATCH 1/4] doc: git-pull: move <repository> and <refspec> params

From: Julia Evans <julia@jvns.ca>
From user feedback:
- it's confusing that we use both <branch> and <refspec> to refer to the
  second argument
- one user is not clear about what `refs/heads/*:refs/remotes/origin/*`
  is meant to be an example of ("is it like a path?")

The DESCRIPTION section is also doing a lot right now: it's trying to describe both how the <repository> and <refspec> arguments work (which is pretty complex, as seen in the DEFAULT BEHAVIOUR section) as well as how `git pull` calls `git fetch` and merge/rebase/etc depending on the arguments.

Handle this by moving the description of the <repository> and <refspec> arguments to the OPTIONS section, so that we can focus on the merge/rebase/etc behaviour in the DESCRIPTION section, and refer folks to the later sections for details.

Use the term "upstream" instead of 'the "remote" and "merge" configuration for the current branch' since users are more likely to know what an "upstream" is.

Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/git-pull.adoc | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)
Show changes to Documentation/git-pull.adoc +18 −11
diff --git a/Documentation/git-pull.adoc b/Documentation/git-pull.adoc
index 48e924a10a..50af7fde81 100644
--- a/Documentation/git-pull.adoc
+++ b/Documentation/git-pull.adoc
@@ -27,17 +27,6 @@ and then depending on configuration options or command line flags,
 will call either `git rebase` or `git merge` to reconcile diverging
 branches.
 
-<repository> should be the name of a remote repository as
-passed to linkgit:git-fetch[1].  <refspec> can name an
-arbitrary remote ref (for example, the name of a tag) or even
-a collection of refs with corresponding remote-tracking branches
-(e.g., refs/heads/{asterisk}:refs/remotes/origin/{asterisk}),
-but usually it is the name of a branch in the remote repository.
-
-Default values for <repository> and <branch> are read from the
-"remote" and "merge" configuration for the current branch
-as set by linkgit:git-branch[1] `--track`.
-
 Assume the following history exists and the current branch is
 "`master`":
 
@@ -77,6 +66,24 @@ pulling or stash them away with linkgit:git-stash[1].
 OPTIONS
 -------
 
+<repository>::
+	The "remote" repository to pull from.  This can be either
+	a URL (see the section <<URLS,GIT URLS>> below) or the name
+	of a remote (see the section <<REMOTES,REMOTES>> below).
++
+Defaults to the configured upstream for the current branch, or `origin`.
+See UPSTREAM BRANCHES below for more on how to configure upstreams.
+
+<refspec>::
+	Which branch or other reference(s) to fetch and integrate into the
+	current branch, for example `main` in `git pull origin main`.
+	Defaults to the configured upstream for the current branch.
++
+This can be a branch, tag, or other collection of reference(s).
+See <refspec> below under "Options related to fetching" for the full syntax,
+and DEFAULT BEHAVIOUR below for how `git pull` uses this argument to
+determine which remote branch to integrate.
+
 -q::
 --quiet::
 	This is passed to both underlying git-fetch to squelch reporting of
-- 
gitgitgadget
D. Ben Knoble· Sep 24, 2025, 20:17 UTC · re: Julia Evans via GitGitGadget · lore

Re: [PATCH 1/4] doc: git-pull: move <repository> and <refspec> params

On Tue, Sep 23, 2025 at 3:45 PM Julia Evans via GitGitGadget <gitgitgadget@gmail.com> wrote:

Show 7 quoted lines
>
> From: Julia Evans <julia@jvns.ca>
>
> From user feedback:
>
> - it's confusing that we use both <branch> and <refspec> to refer to the
>   second argument
Yep.
> - one user is not clear about what `refs/heads/*:refs/remotes/origin/*`
>   is meant to be an example of ("is it like a path?")

Also yep, since the deleted text doesn't contain any pointers to learn what a refspec is.

Show 10 quoted lines
> The DESCRIPTION section is also doing a lot right now: it's trying to
> describe both how the <repository> and <refspec> arguments work (which
> is pretty complex, as seen in the DEFAULT BEHAVIOUR section)
> as well as how `git pull` calls `git fetch` and merge/rebase/etc
> depending on the arguments.
>
> Handle this by moving the description of the <repository> and <refspec>
> arguments to the OPTIONS section, so that we can focus on the
> merge/rebase/etc behaviour in the DESCRIPTION section, and refer folks
> to the later sections for details.

I generally like this: it makes things a bit more consistent, even though "options" isn't quite how I think of these (optional!) positional parameters. Still, I generally jump down to the <arg> sections (like in git-push(1)) to learn what I can do with those.

> Use the term "upstream" instead of 'the "remote" and "merge"
> configuration for the current branch' since users are more likely to
> know what an "upstream" is.
With the upstream section, great.
Show 18 quoted lines
> diff --git a/Documentation/git-pull.adoc b/Documentation/git-pull.adoc
> index 48e924a10a..50af7fde81 100644
> --- a/Documentation/git-pull.adoc
> +++ b/Documentation/git-pull.adoc
> @@ -27,17 +27,6 @@ and then depending on configuration options or command line flags,
>  will call either `git rebase` or `git merge` to reconcile diverging
>  branches.
>
> -<repository> should be the name of a remote repository as
> -passed to linkgit:git-fetch[1].  <refspec> can name an
> -arbitrary remote ref (for example, the name of a tag) or even
> -a collection of refs with corresponding remote-tracking branches
> -(e.g., refs/heads/{asterisk}:refs/remotes/origin/{asterisk}),
> -but usually it is the name of a branch in the remote repository.
> -
> -Default values for <repository> and <branch> are read from the
> -"remote" and "merge" configuration for the current branch
> -as set by linkgit:git-branch[1] `--track`.

And we don't even mind losing "--track" here because we cover it in Upstream Branches (e.g., https://lore.kernel.org/git/3ecfb5c3a67723f160e8161e212d77f95964539c.1758649472.git.gitgitgadget@gmail.com/).

Show 26 quoted lines
> -
>  Assume the following history exists and the current branch is
>  "`master`":
>
> @@ -77,6 +66,24 @@ pulling or stash them away with linkgit:git-stash[1].
>  OPTIONS
>  -------
>
> +<repository>::
> +       The "remote" repository to pull from.  This can be either
> +       a URL (see the section <<URLS,GIT URLS>> below) or the name
> +       of a remote (see the section <<REMOTES,REMOTES>> below).
> ++
> +Defaults to the configured upstream for the current branch, or `origin`.
> +See UPSTREAM BRANCHES below for more on how to configure upstreams.
> +
> +<refspec>::
> +       Which branch or other reference(s) to fetch and integrate into the
> +       current branch, for example `main` in `git pull origin main`.
> +       Defaults to the configured upstream for the current branch.
> ++
> +This can be a branch, tag, or other collection of reference(s).
> +See <refspec> below under "Options related to fetching" for the full syntax,
> +and DEFAULT BEHAVIOUR below for how `git pull` uses this argument to
> +determine which remote branch to integrate.
> +

I think these are covered in Documentation/pull-fetch-param.adoc, which I only found by looking at "git help pull" and searching for the URLs references, hah.

Anyway, the existing explanations are far too late in the manual (Vim says ~46%, 960 lines down, when rendered with MANWIDTH=80). Moving them up is a good idea, but maybe we need to do that in a way that jives with the later "fetching" section. Hm.

-- 
D. Ben Knoble
Julia Evans· Oct 7, 2025, 21:20 UTC · re: D. Ben Knoble · lore

Re: [PATCH 1/4] doc: git-pull: move <repository> and <refspec> params

On Wed, Sep 24, 2025, at 4:17 PM, D. Ben Knoble wrote:
Show 98 quoted lines
> On Tue, Sep 23, 2025 at 3:45 PM Julia Evans via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
>>
>> From: Julia Evans <julia@jvns.ca>
>>
>> From user feedback:
>>
>> - it's confusing that we use both <branch> and <refspec> to refer to the
>>   second argument
>
> Yep.
>
>> - one user is not clear about what `refs/heads/*:refs/remotes/origin/*`
>>   is meant to be an example of ("is it like a path?")
>
> Also yep, since the deleted text doesn't contain any pointers to learn
> what a refspec is.
>
>> The DESCRIPTION section is also doing a lot right now: it's trying to
>> describe both how the <repository> and <refspec> arguments work (which
>> is pretty complex, as seen in the DEFAULT BEHAVIOUR section)
>> as well as how `git pull` calls `git fetch` and merge/rebase/etc
>> depending on the arguments.
>>
>> Handle this by moving the description of the <repository> and <refspec>
>> arguments to the OPTIONS section, so that we can focus on the
>> merge/rebase/etc behaviour in the DESCRIPTION section, and refer folks
>> to the later sections for details.
>
> I generally like this: it makes things a bit more consistent, even
> though "options" isn't quite how I think of these (optional!)
> positional parameters. Still, I generally jump down to the <arg>
> sections (like in git-push(1)) to learn what I can do with those.
>
>> Use the term "upstream" instead of 'the "remote" and "merge"
>> configuration for the current branch' since users are more likely to
>> know what an "upstream" is.
>
> With the upstream section, great.
>
>> diff --git a/Documentation/git-pull.adoc b/Documentation/git-pull.adoc
>> index 48e924a10a..50af7fde81 100644
>> --- a/Documentation/git-pull.adoc
>> +++ b/Documentation/git-pull.adoc
>> @@ -27,17 +27,6 @@ and then depending on configuration options or command line flags,
>>  will call either `git rebase` or `git merge` to reconcile diverging
>>  branches.
>>
>> -<repository> should be the name of a remote repository as
>> -passed to linkgit:git-fetch[1].  <refspec> can name an
>> -arbitrary remote ref (for example, the name of a tag) or even
>> -a collection of refs with corresponding remote-tracking branches
>> -(e.g., refs/heads/{asterisk}:refs/remotes/origin/{asterisk}),
>> -but usually it is the name of a branch in the remote repository.
>> -
>> -Default values for <repository> and <branch> are read from the
>> -"remote" and "merge" configuration for the current branch
>> -as set by linkgit:git-branch[1] `--track`.
>
> And we don't even mind losing "--track" here because we cover it in
> Upstream Branches (e.g.,
> https://lore.kernel.org/git/3ecfb5c3a67723f160e8161e212d77f95964539c.1758649472.git.gitgitgadget@gmail.com/).
>
>> -
>>  Assume the following history exists and the current branch is
>>  "`master`":
>>
>> @@ -77,6 +66,24 @@ pulling or stash them away with linkgit:git-stash[1].
>>  OPTIONS
>>  -------
>>
>> +<repository>::
>> +       The "remote" repository to pull from.  This can be either
>> +       a URL (see the section <<URLS,GIT URLS>> below) or the name
>> +       of a remote (see the section <<REMOTES,REMOTES>> below).
>> ++
>> +Defaults to the configured upstream for the current branch, or `origin`.
>> +See UPSTREAM BRANCHES below for more on how to configure upstreams.
>> +
>> +<refspec>::
>> +       Which branch or other reference(s) to fetch and integrate into the
>> +       current branch, for example `main` in `git pull origin main`.
>> +       Defaults to the configured upstream for the current branch.
>> ++
>> +This can be a branch, tag, or other collection of reference(s).
>> +See <refspec> below under "Options related to fetching" for the full syntax,
>> +and DEFAULT BEHAVIOUR below for how `git pull` uses this argument to
>> +determine which remote branch to integrate.
>> +
>
> I think these are covered in Documentation/pull-fetch-param.adoc,
> which I only found by looking at "git help pull" and searching for the
> URLs references, hah.
>
> Anyway, the existing explanations are far too late in the manual (Vim
> says ~46%, 960 lines down, when rendered with MANWIDTH=80). Moving
> them up is a good idea, but maybe we need to do that in a way that
> jives with the later "fetching" section. Hm.

That's a good point. It's a bit weird because (I think) `git pull does use the <refspec> parameter after passing it to `git fetch` (to decide which remote branch to merge), so we can't just say "to know what the refspec parameter does, see "git fetch", and we can't just copy the existing <refspec> section further up.

Rewriting the <refspec> section of `git fetch` so that it addresses both the `git pull` and `git fetch` case seems like it would just add more confusion.

Duplicating the content of the <repository> bit and then referencing the second <refspec> section below is the least bad option I can think of right now, since most of the time you don't actually need to know how to write a refspec.

I'll add some internal links in the HTML version to the <refspec> and DEFAULT BEHAVIOUR sections so that they'll be easier to find in the HTML version at least.

Julia Evans via GitGitGadget· Sep 23, 2025, 19:45 UTC · re: Julia Evans via GitGitGadget · lore

[PATCH 2/4] doc: git-pull: clarify options for integrating remote branch

From: Julia Evans <julia@jvns.ca>
From user feedback:
- One user is confused about the current default ("I was convinced that
  the git default was still to merge on pull")
- One user is confused about why "git fetch" isn't mentioned earlier
- One user says they always forget what the arguments to `git pull` are
  and that it's not immediately obvious that `--no-rebase` means "merge"
- One user wants `--ff-only` to be mentioned

Resolve this by listing the options for integrating the the remote branch. This should help users figure out at a glance which one they want to do, and make it clearer that --ff-only is the default.

Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/git-pull.adoc | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)
Show changes to Documentation/git-pull.adoc +14 −11
diff --git a/Documentation/git-pull.adoc b/Documentation/git-pull.adoc
index 50af7fde81..61d18fef36 100644
--- a/Documentation/git-pull.adoc
+++ b/Documentation/git-pull.adoc
@@ -15,17 +15,20 @@ SYNOPSIS
 DESCRIPTION
 -----------
 
-Incorporates changes from a remote repository into the current branch.
-If the current branch is behind the remote, then by default it will
-fast-forward the current branch to match the remote.  If the current
-branch and the remote have diverged, the user needs to specify how to
-reconcile the divergent branches with `--rebase` or `--no-rebase` (or
-the corresponding configuration option in `pull.rebase`).
-
-More precisely, `git pull` runs `git fetch` with the given parameters
-and then depending on configuration options or command line flags,
-will call either `git rebase` or `git merge` to reconcile diverging
-branches.
+Integrate changes from a remote repository into the current branch.
+
+First, `git pull` runs `git fetch` with the same arguments to fetch
+remote branch(es). Then it integrates the remote branch into the current
+branch. There are 4 main options for integrating the remote branch:
+
+1. `git pull --ff-only` will only do "fast-forward" updates: it
+   fails if the remote branch has diverged. This is the default.
+2. `git pull --rebase` runs `git rebase`
+3. `git pull --no-rebase` runs `git merge`.
+4. `git pull --squash` runs `git merge --squash`
+
+You can also set the configuration options `pull.rebase`, `pull.squash`,
+or `pull.ff` with your preferred behaviour.
 
 Assume the following history exists and the current branch is
 "`master`":
-- 
gitgitgadget
D. Ben Knoble· Sep 24, 2025, 20:23 UTC · re: Julia Evans via GitGitGadget · lore

Re: [PATCH 2/4] doc: git-pull: clarify options for integrating remote branch

On Tue, Sep 23, 2025 at 3:48 PM Julia Evans via GitGitGadget <gitgitgadget@gmail.com> wrote:

Show 43 quoted lines
>
> From: Julia Evans <julia@jvns.ca>
>
> From user feedback:
>
> - One user is confused about the current default ("I was convinced that
>   the git default was still to merge on pull")
> - One user is confused about why "git fetch" isn't mentioned earlier
> - One user says they always forget what the arguments to `git pull` are
>   and that it's not immediately obvious that `--no-rebase` means "merge"
> - One user wants `--ff-only` to be mentioned
>
> Resolve this by listing the options for integrating the the remote
> branch. This should help users figure out at a glance which one they
> want to do, and make it clearer that --ff-only is the default.
>
> Signed-off-by: Julia Evans <julia@jvns.ca>
> ---
>  Documentation/git-pull.adoc | 25 ++++++++++++++-----------
>  1 file changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/Documentation/git-pull.adoc b/Documentation/git-pull.adoc
> index 50af7fde81..61d18fef36 100644
> --- a/Documentation/git-pull.adoc
> +++ b/Documentation/git-pull.adoc
> @@ -15,17 +15,20 @@ SYNOPSIS
>  DESCRIPTION
>  -----------
>
> -Incorporates changes from a remote repository into the current branch.
> -If the current branch is behind the remote, then by default it will
> -fast-forward the current branch to match the remote.  If the current
> -branch and the remote have diverged, the user needs to specify how to
> -reconcile the divergent branches with `--rebase` or `--no-rebase` (or
> -the corresponding configuration option in `pull.rebase`).
> -
> -More precisely, `git pull` runs `git fetch` with the given parameters
> -and then depending on configuration options or command line flags,
> -will call either `git rebase` or `git merge` to reconcile diverging
> -branches.
> +Integrate changes from a remote repository into the current branch.
> +
> +First, `git pull` runs `git fetch` with the same arguments to fetch

Hm. Is it worth saying "similar" rather than "same" since we don't pass e.g. `--rebase` to `git fetch`? Or is that detail unimportant in this context?

> +remote branch(es). Then it integrates the remote branch into the current
> +branch.

Plural-singular here leaves me wondering how Git decides which of multiple fetched branches to integrate. A quick test of the form

    git pull origin refs/heads/\*:refs/remotes/origin/\*
just gives an error in every mode I tried, so I'm now confused about this use :)

I _do_ like that when I "git pull", Git will fetch all branches if I have fetch.all set. That seems related but different. Welp, more corners to explore!

Show 10 quoted lines
> There are 4 main options for integrating the remote branch:
> +
> +1. `git pull --ff-only` will only do "fast-forward" updates: it
> +   fails if the remote branch has diverged. This is the default.
> +2. `git pull --rebase` runs `git rebase`
> +3. `git pull --no-rebase` runs `git merge`.
> +4. `git pull --squash` runs `git merge --squash`
> +
> +You can also set the configuration options `pull.rebase`, `pull.squash`,
> +or `pull.ff` with your preferred behaviour.
Lovely.
-- 
D. Ben Knoble
Julia Evans· Sep 24, 2025, 20:54 UTC · re: D. Ben Knoble · lore

Re: [PATCH 2/4] doc: git-pull: clarify options for integrating remote branch

Show 11 quoted lines
>> -More precisely, `git pull` runs `git fetch` with the given parameters
>> -and then depending on configuration options or command line flags,
>> -will call either `git rebase` or `git merge` to reconcile diverging
>> -branches.
>> +Integrate changes from a remote repository into the current branch.
>> +
>> +First, `git pull` runs `git fetch` with the same arguments to fetch
>
> Hm. Is it worth saying "similar" rather than "same" since we don't
> pass e.g. `--rebase` to `git fetch`? Or is that detail unimportant in
> this context?
That's a good point, I'll try to think of a better way to phrase it.

I guess the truth is that `git pull` has three categories of options, those it passes verbatim to `git fetch`, those it passes verbatim to `git merge`, and the others (-q, -v, and --recurse-submodules). That's a bit of a mouthful but maybe there's a way to say that explicitly that isn't too awkward, it does seem helpful to know when reading the OPTIONS section.

Show 9 quoted lines
>> +remote branch(es). Then it integrates the remote branch into the current
>> +branch.
>
> Plural-singular here leaves me wondering how Git decides which of
> multiple fetched branches to integrate. A quick test of the form
>
>     git pull origin refs/heads/\*:refs/remotes/origin/\*
>
> just gives an error in every mode I tried, so I'm now confused about this use :)

I find it confusing too. My current strategy for handling this here is to somewhat awkwardly say "it's explained in the DEFAULT BEHAVIOUR section" a bit further down.

It's a tricky situation because I find the DEFAULT BEHAVIOUR section very confusing. It seems like there's a fair amount of duplication with other sections that could be cleaned up to make it easier. But removing the duplication and making it easier to understand feels like too many changes for this series, especially because really doing it well probably involves the sub-project of "clean up the <refspec> section of the `git fetch` man page".

In any case, I'll see if I can find a way to make it a little less awkward.
Chris Torek· Sep 24, 2025, 22:38 UTC · re: D. Ben Knoble · lore

Re: [PATCH 2/4] doc: git-pull: clarify options for integrating remote branch

On Wed, Sep 24, 2025 at 1:23 PM D. Ben Knoble <ben.knoble@gmail.com> wrote:
Show 5 quoted lines
> > +First, `git pull` runs `git fetch` with the same arguments to fetch
>
> Hm. Is it worth saying "similar" rather than "same" since we don't
> pass e.g. `--rebase` to `git fetch`? Or is that detail unimportant in
> this context?

I would suggest "equivalent" or (perhaps better) "appropriate". Perhaps even:

    First, `git pull` runs the equivalent of `git fetch` with the
    arguments needed to fetch necessary branches from
    the remote ...

Definition of these arguments can be deferred (perhaps even indefinitely); but:

Show 5 quoted lines
> > +remote branch(es). Then it integrates the remote branch into the current
> > +branch.
>
> Plural-singular here leaves me wondering how Git decides which of
> multiple fetched branches to integrate.
here we'd need something along the lines of:
    Then it integrates the appropriate remote branch ...
and here we *do* have to define "appropriate".

(Historically the merge step grabbed stuff from FETCH_HEAD, excluding all the "not-for-merge" parts, and I have never dug into what happens now...)

Chris
Julia Evans· Oct 6, 2025, 21:16 UTC · re: Chris Torek · lore

Re: [PATCH 2/4] doc: git-pull: clarify options for integrating remote branch

On Wed, Sep 24, 2025, at 6:38 PM, Chris Torek wrote:
Show 28 quoted lines
> On Wed, Sep 24, 2025 at 1:23 PM D. Ben Knoble <ben.knoble@gmail.com> wrote:
>> > +First, `git pull` runs `git fetch` with the same arguments to fetch
>>
>> Hm. Is it worth saying "similar" rather than "same" since we don't
>> pass e.g. `--rebase` to `git fetch`? Or is that detail unimportant in
>> this context?
>
> I would suggest "equivalent" or (perhaps better) "appropriate".
> Perhaps even:
>
>     First, `git pull` runs the equivalent of `git fetch` with the
>     arguments needed to fetch necessary branches from
>     the remote ...
>
> Definition of these arguments can be deferred (perhaps
> even indefinitely); but:
>
>> > +remote branch(es). Then it integrates the remote branch into the current
>> > +branch.
>>
>> Plural-singular here leaves me wondering how Git decides which of
>> multiple fetched branches to integrate.
>
> here we'd need something along the lines of:
>
>     Then it integrates the appropriate remote branch ...
>
> and here we *do* have to define "appropriate".

I like the idea of adding "appropriate" here. The question of how to define it is a little messy.

We do define "appropriate" below under <refspec>, like this:
> See <refspec> below under "Options related to fetching" for the full syntax,
> and DEFAULT BEHAVIOUR below for how `git pull` uses this argument to
> determine which remote branch to integrate.

Like I mentioned in another reply I think deferring the question of what "the appropriate branch" is to the DEFAULT BEHAVIOUR section like this does is not a "good" long-term solution because that section is so confusing, but I think it's not worse than the current state and I don't want to expand the scope of this patch series too much.

However! I think there's a question of what behaviour to "encourage". Over on the `git push` side, we decided to highlight using `git push origin main` to push, because the behaviour of `git push origin main` is simple to explain ("it pushes the local main branch to the main on the `origin` remote").

So a natural next question is: should we equivalently highlight "git pull origin main", to mirror the `git push` man page? Then it would be easy to say what "the appropriate branch" is, because in that case the branch is "whatever branch you specified"

My initial instinct is "no": `git push origin main` also feels sort of "foolproof" to me, in the sense that if you accidentally run it while on the wrong branch, nothing really bad will happen, since it doesn't matter what your current branch is.

But `git pull` is not the same, since running `git pull origin <wrong-branch>` will integrate <wrong-branch> into your current branch, which could get confusing if you accidentally pulled while on the wrong branch. Personally I use `git pull` without any arguments, and it feels safer to me that way because I know that I'm likely to have set my upstream to something reasonable.

I also did some extremely informal and low-sample-size Mastodon polling and my sense so far is that folks tend to run `git pull` with no arguments in practice. So I think it makes sense to highlight the no-arguments version.

And in any case if you want to get really specific about what you're pulling I think going straight to "manually fetch and then run `git merge` yourself" is a safer approach instead of passing arguments to `git pull`.

All of that is to say: my best idea for how to resolve all of this is as follows:
Show 5 quoted lines
> First, `git pull` runs `git fetch` with the same arguments
> (excluding merge options) to fetch remote branch(es).
> Then it decides which remote branch to integrate: if you run `git pull`
> with no arguments this defaults to the upstream for the current branch.
> Then it integrates that branch into the current branch.

This explains what the "appropriate branch" is in (I think) the most common use case and deals with the "same arguments" issue.

Julia Evans via GitGitGadget· Sep 23, 2025, 19:45 UTC · re: Julia Evans via GitGitGadget · lore

[PATCH 3/4] doc: git-pull: delete the example

From: Julia Evans <julia@jvns.ca>

From user feedback: this example is confusing because it implies that `git pull` will run `git merge` by default, but the default is `--ff-only`.

We could instead show an example of a fast-forward merge, but that may not add a lot since fast-forward merges are relatively simple. This lets us keep the description short.

Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/git-pull.adoc | 26 --------------------------
 1 file changed, 26 deletions(-)
Show changes to Documentation/git-pull.adoc +0 −22
diff --git a/Documentation/git-pull.adoc b/Documentation/git-pull.adoc
index 61d18fef36..91903b0a94 100644
--- a/Documentation/git-pull.adoc
+++ b/Documentation/git-pull.adoc
@@ -30,32 +30,6 @@ branch. There are 4 main options for integrating the remote branch:
 You can also set the configuration options `pull.rebase`, `pull.squash`,
 or `pull.ff` with your preferred behaviour.
 
-Assume the following history exists and the current branch is
-"`master`":
-
-------------
-	  A---B---C master on origin
-	 /
-    D---E---F---G master
-	^
-	origin/master in your repository
-------------
-
-Then "`git pull`" will fetch and replay the changes from the remote
-`master` branch since it diverged from the local `master` (i.e., `E`)
-until its current commit (`C`) on top of `master` and record the
-result in a new commit along with the names of the two parent commits
-and a log message from the user describing the changes.
-
-------------
-	  A---B---C origin/master
-	 /         \
-    D---E---F---G---H master
-------------
-
-See linkgit:git-merge[1] for details, including how conflicts
-are presented and handled.
-
 In Git 1.7.0 or later, to cancel a conflicting merge, use
 `git reset --merge`.  *Warning*: In older versions of Git, running 'git pull'
 with uncommitted changes is discouraged: while possible, it leaves you
-- 
gitgitgadget
Julia Evans via GitGitGadget· Sep 23, 2025, 19:45 UTC · re: Julia Evans via GitGitGadget · lore

[PATCH 4/4] doc: git-pull: clarify how to exit a conflicted merge

From: Julia Evans <julia@jvns.ca>
From user feedback:
- One user is confused about why `git reset --merge`
  (why not just `git reset`?). Handle this by mentioning
  `git merge --abort` and `git reset --abort` instead, which have a
  more obvious meaning.
- 2 users want to know what "In older versions of Git" means exactly
  (in versions older than 1.7.0). Handle this by removing the warning
  since it was added 15 years ago (in 3f8fc184c0e2c)
Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/git-pull.adoc | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
Show changes to Documentation/git-pull.adoc +3 −9
diff --git a/Documentation/git-pull.adoc b/Documentation/git-pull.adoc
index 91903b0a94..eec05ab6c7 100644
--- a/Documentation/git-pull.adoc
+++ b/Documentation/git-pull.adoc
@@ -30,15 +30,9 @@ branch. There are 4 main options for integrating the remote branch:
 You can also set the configuration options `pull.rebase`, `pull.squash`,
 or `pull.ff` with your preferred behaviour.
 
-In Git 1.7.0 or later, to cancel a conflicting merge, use
-`git reset --merge`.  *Warning*: In older versions of Git, running 'git pull'
-with uncommitted changes is discouraged: while possible, it leaves you
-in a state that may be hard to back out of in the case of a conflict.
-
-If any of the remote changes overlap with local uncommitted changes,
-the merge will be automatically canceled and the work tree untouched.
-It is generally best to get any local changes in working order before
-pulling or stash them away with linkgit:git-stash[1].
+If there's a merge conflict during the merge or rebase that you don't
+want to handle, you can safely abort it with `git merge --abort` or `git
+--rebase abort`.
 
 OPTIONS
 -------
-- 
gitgitgadget
Julia Evans· Sep 24, 2025, 17:21 UTC · re: Julia Evans via GitGitGadget · lore

Re: [PATCH 4/4] doc: git-pull: clarify how to exit a conflicted merge

On Tue, Sep 23, 2025, at 3:45 PM, Julia Evans via GitGitGadget wrote:
Show 36 quoted lines
> From: Julia Evans <julia@jvns.ca>
>
> From user feedback:
>
> - One user is confused about why `git reset --merge`
>   (why not just `git reset`?). Handle this by mentioning
>   `git merge --abort` and `git reset --abort` instead, which have a
>   more obvious meaning.
> - 2 users want to know what "In older versions of Git" means exactly
>   (in versions older than 1.7.0). Handle this by removing the warning
>   since it was added 15 years ago (in 3f8fc184c0e2c)
>
> Signed-off-by: Julia Evans <julia@jvns.ca>
> ---
>  Documentation/git-pull.adoc | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/Documentation/git-pull.adoc b/Documentation/git-pull.adoc
> index 91903b0a94..eec05ab6c7 100644
> --- a/Documentation/git-pull.adoc
> +++ b/Documentation/git-pull.adoc
> @@ -30,15 +30,9 @@ branch. There are 4 main options for integrating the 
> remote branch:
>  You can also set the configuration options `pull.rebase`, 
> `pull.squash`,
>  or `pull.ff` with your preferred behaviour.
> 
> -In Git 1.7.0 or later, to cancel a conflicting merge, use
> -`git reset --merge`.  *Warning*: In older versions of Git, running 'git pull'
> -with uncommitted changes is discouraged: while possible, it leaves you
> -in a state that may be hard to back out of in the case of a conflict.
> -
> -If any of the remote changes overlap with local uncommitted changes,
> -the merge will be automatically canceled and the work tree untouched.
> -It is generally best to get any local changes in working order before
> -pulling or stash them away with linkgit:git-stash[1].

After sending this I thought to read the `git merge` man page, which has this warning:

> WARNING: Running `git merge` with non-trivial uncommitted changes is

discouraged: while possible, it may leave you in a state that is hard to back out of in the case of a conflict.

I think I was probably too hasty in removing the warning entirely, since I mainly use `git pull --rebase` and I hadn't fully thought through how `git merge` has a different approach to uncommitted changes than `git rebase`.

I think a warning similar to that one would make sense, since any warning that applies to `git merge` should also apply to `git pull`.

> +If there's a merge conflict during the merge or rebase that you don't
> +want to handle, you can safely abort it with `git merge --abort` or `git
> +--rebase abort`.
Also I noticed a typo in `git --rebase abort` :)
D. Ben Knoble· Sep 24, 2025, 20:29 UTC · re: Julia Evans via GitGitGadget · lore

Re: [PATCH 4/4] doc: git-pull: clarify how to exit a conflicted merge

On Tue, Sep 23, 2025 at 3:48 PM Julia Evans via GitGitGadget <gitgitgadget@gmail.com> wrote:

Show 9 quoted lines
>
> From: Julia Evans <julia@jvns.ca>
>
> From user feedback:
>
> - One user is confused about why `git reset --merge`
>   (why not just `git reset`?). Handle this by mentioning
>   `git merge --abort` and `git reset --abort` instead, which have a
>   more obvious meaning.

"git reset --merge" _can_ be helpful when merging, but won't fully abort a rebase. Great.

Show 18 quoted lines
> --- a/Documentation/git-pull.adoc
> +++ b/Documentation/git-pull.adoc
> @@ -30,15 +30,9 @@ branch. There are 4 main options for integrating the remote branch:
>  You can also set the configuration options `pull.rebase`, `pull.squash`,
>  or `pull.ff` with your preferred behaviour.
>
> -In Git 1.7.0 or later, to cancel a conflicting merge, use
> -`git reset --merge`.  *Warning*: In older versions of Git, running 'git pull'
> -with uncommitted changes is discouraged: while possible, it leaves you
> -in a state that may be hard to back out of in the case of a conflict.
> -
> -If any of the remote changes overlap with local uncommitted changes,
> -the merge will be automatically canceled and the work tree untouched.
> -It is generally best to get any local changes in working order before
> -pulling or stash them away with linkgit:git-stash[1].
> +If there's a merge conflict during the merge or rebase that you don't
> +want to handle, you can safely abort it with `git merge --abort` or `git
> +--rebase abort`.

This information is also mentioned in the advice given by conflicts (and git status), so while I originally wondered if we need to say "to know which to use, run…", I now think we can trust users to know whether they asked for a merge or rebase and read the advice/git status output when they don't.

Hah, just kidding. Nobody* reads that output. But I still don't think it's worth muddying here, because the same folks are unlikely to see the help here, right? Or maybe we say "Information in `git status` will summarize these options for you." ?

[*] Obviously untrue, but you all know what I mean
-- 
D. Ben Knoble
Julia Evans· Oct 7, 2025, 21:01 UTC · re: D. Ben Knoble · lore

Re: [PATCH 4/4] doc: git-pull: clarify how to exit a conflicted merge

On Wed, Sep 24, 2025, at 4:29 PM, D. Ben Knoble wrote:
Show 44 quoted lines
> On Tue, Sep 23, 2025 at 3:48 PM Julia Evans via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
>>
>> From: Julia Evans <julia@jvns.ca>
>>
>> From user feedback:
>>
>> - One user is confused about why `git reset --merge`
>>   (why not just `git reset`?). Handle this by mentioning
>>   `git merge --abort` and `git reset --abort` instead, which have a
>>   more obvious meaning.
>
> "git reset --merge" _can_ be helpful when merging, but won't fully
> abort a rebase. Great.
>
>> --- a/Documentation/git-pull.adoc
>> +++ b/Documentation/git-pull.adoc
>> @@ -30,15 +30,9 @@ branch. There are 4 main options for integrating the remote branch:
>>  You can also set the configuration options `pull.rebase`, `pull.squash`,
>>  or `pull.ff` with your preferred behaviour.
>>
>> -In Git 1.7.0 or later, to cancel a conflicting merge, use
>> -`git reset --merge`.  *Warning*: In older versions of Git, running 'git pull'
>> -with uncommitted changes is discouraged: while possible, it leaves you
>> -in a state that may be hard to back out of in the case of a conflict.
>> -
>> -If any of the remote changes overlap with local uncommitted changes,
>> -the merge will be automatically canceled and the work tree untouched.
>> -It is generally best to get any local changes in working order before
>> -pulling or stash them away with linkgit:git-stash[1].
>> +If there's a merge conflict during the merge or rebase that you don't
>> +want to handle, you can safely abort it with `git merge --abort` or `git
>> +--rebase abort`.
>
> This information is also mentioned in the advice given by conflicts
> (and git status), so while I originally wondered if we need to say "to
> know which to use, run…", I now think we can trust users to know
> whether they asked for a merge or rebase and read the advice/git
> status output when they don't.
>
> Hah, just kidding. Nobody* reads that output. But I still don't think
> it's worth muddying here, because the same folks are unlikely to see
> the help here, right? Or maybe we say "Information in `git status`
> will summarize these options for you." ?

I think it's a nice way to reiterate that `git pull` is running a merge or rebase under the hood, but if folks feel strongly that this isn't relevant I'd be happy to remove the `git merge --abort` / `git rebase --abort` note.

Ben Knoble· Oct 10, 2025, 00:45 UTC · re: Julia Evans · lore

Re: [PATCH 4/4] doc: git-pull: clarify how to exit a conflicted merge

Show 19 quoted lines
> Le 7 oct. 2025 à 17:01, Julia Evans <julia@jvns.ca> a écrit :
> 
> 
> 
>> On Wed, Sep 24, 2025, at 4:29 PM, D. Ben Knoble wrote:
>>> On Tue, Sep 23, 2025 at 3:48 PM Julia Evans via GitGitGadget
>>> <gitgitgadget@gmail.com> wrote:
>>> 
>>> From: Julia Evans <julia@jvns.ca>
>>> 
>>> From user feedback:
>>> 
>>> - One user is confused about why `git reset --merge`
>>>  (why not just `git reset`?). Handle this by mentioning
>>>  `git merge --abort` and `git reset --abort` instead, which have a
>>>  more obvious meaning.
>> 
>> "git reset --merge" _can_ be helpful when merging, but won't fully
>> abort a rebase. Great.
While fiddling around: turns out reset’s merge flag does abort the merge properly. TMTOWTDI, I suppose. 
Show 34 quoted lines
>> 
>>> --- a/Documentation/git-pull.adoc
>>> +++ b/Documentation/git-pull.adoc
>>> @@ -30,15 +30,9 @@ branch. There are 4 main options for integrating the remote branch:
>>> You can also set the configuration options `pull.rebase`, `pull.squash`,
>>> or `pull.ff` with your preferred behaviour.
>>> 
>>> -In Git 1.7.0 or later, to cancel a conflicting merge, use
>>> -`git reset --merge`.  *Warning*: In older versions of Git, running 'git pull'
>>> -with uncommitted changes is discouraged: while possible, it leaves you
>>> -in a state that may be hard to back out of in the case of a conflict.
>>> -
>>> -If any of the remote changes overlap with local uncommitted changes,
>>> -the merge will be automatically canceled and the work tree untouched.
>>> -It is generally best to get any local changes in working order before
>>> -pulling or stash them away with linkgit:git-stash[1].
>>> +If there's a merge conflict during the merge or rebase that you don't
>>> +want to handle, you can safely abort it with `git merge --abort` or `git
>>> +--rebase abort`.
>> 
>> This information is also mentioned in the advice given by conflicts
>> (and git status), so while I originally wondered if we need to say "to
>> know which to use, run…", I now think we can trust users to know
>> whether they asked for a merge or rebase and read the advice/git
>> status output when they don't.
>> 
>> Hah, just kidding. Nobody* reads that output. But I still don't think
>> it's worth muddying here, because the same folks are unlikely to see
>> the help here, right? Or maybe we say "Information in `git status`
>> will summarize these options for you." ?
> 
> I think it's a nice way to reiterate that `git pull` is running a merge or
> rebase under the hood, but if folks feel strongly that this isn't relevant
> I'd be happy to remove the `git merge --abort` / `git rebase --abort` note.
I’d probably prefer to keep the pull->{merge,rebase} implication. I just want « how do I know which one » to be clear.
D. Ben Knoble· Sep 24, 2025, 19:56 UTC · re: Julia Evans via GitGitGadget · lore

Re: [PATCH 0/4] doc: git-pull: clarify DESCRIPTION section

On Tue, Sep 23, 2025 at 3:45 PM Julia Evans via GitGitGadget <gitgitgadget@gmail.com> wrote:

Show 9 quoted lines
>
> I got feedback from 15 Git users on the current git pull man page, using
> this tool: https://text-feedback.wizardzines.com/git-pull.
>
> My goals here are to be clear about the relationship between git pull and
> fetch/merge/rebase etc, make sure users know the current default for git
> pull (--ff-only) since some folks still remember the old default, and to
> help users quickly figure out what command they need to run to
> merge/rebase/squash/etc.

Huh! I thought pull would merge divergent histories by default, and even now it's hard to extract that info from the manual (the first paragraph actually mentions reconciliation via --rebase/--no-rebase, but I thought --no-rebase was still the default). TIL, thanks!

Show 7 quoted lines
> I've taken a pretty aggressive approach because I think it's possible to
> have a pretty short and focused DESCRIPTION section here while keeping the
> most important info. Open to hearing that I've removed too much.
>
> This references the UPSTREAM BRANCHES section from
> https://lore.kernel.org/git/0ec629d4037bf5d1ccc248ca1bbd87ccc08119a3.1757703309.git.gitgitgadget@gmail.com/
> , so if that isn't merged I'll need to revisit the approach here.

A common way to handle this is to build your topic on top of the topic you depend on, and then mention that in your cover letter. I'm not sure how GitGitGadget handles that, though, since with format-patch you could then specify to send patches only from <other-topic>..<this-topic>. So I think this is probably ok?

-- 
D. Ben Knoble
Julia Evans via GitGitGadget· Oct 8, 2025, 19:25 UTC · re: Julia Evans via GitGitGadget · lore

[PATCH v2 0/4] doc: git-pull: clarify DESCRIPTION section

I got feedback from 15 Git users on the current git pull man page, using this tool: https://text-feedback.wizardzines.com/git-pull.

My goals here are to be clear about the relationship between git pull and fetch/merge/rebase etc, make sure users know the current default for git pull (--ff-only) since some folks still remember the old default, and to help users quickly figure out what command they need to run to merge/rebase/squash/etc.

I've taken a pretty aggressive approach because I think it's possible to have a pretty short and focused DESCRIPTION section here while keeping the most important info. Open to hearing that I've removed too much.

This references the UPSTREAM BRANCHES section from https://lore.kernel.org/git/0ec629d4037bf5d1ccc248ca1bbd87ccc08119a3.1757703309.git.gitgitgadget@gmail.com/ , so if that isn't merged I'll need to revisit the approach here.

changes in v2:
 * Add "(excluding merge options)" to clarify which options are passed to
   git fetch (from Chris's review)
 * Say that git pull will by default merge the upstream branch. (from
   Chris's review)
 * Add some links to the UPSTREAM BRANCHES section, and to the <refspec>
   section in git fetch, to make it easier to navigate in the HTML version
   of the docs at least. The situation where we repeat the <repository> part
   in git fetch is weird but I don't have a better idea for how to handle it
   right now. The UPSTREAM BRANCHES links are currently failing the
   documentation tests, but should pass once the patch series that adds that
   is merged. (from Ben's review)
Julia Evans (4):
  doc: git-pull: move <repository> and <refspec> params
  doc: git-pull: clarify options for integrating remote branch
  doc: git-pull: delete the example
  doc: git-pull: clarify how to exit a conflicted merge
 Documentation/git-pull.adoc         | 92 ++++++++++++-----------------
 Documentation/pull-fetch-param.adoc |  1 +
 2 files changed, 40 insertions(+), 53 deletions(-)
base-commit: ca2559c1d630eb4f04cdee2328aaf1c768907a9e
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1976%2Fjvns%2Fclarify-pull-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1976/jvns/clarify-pull-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1976
Range-diff vs v1:
 1:  f69d2e6fab ! 1:  4cc87ec354 doc: git-pull: move <repository> and <refspec> params
     @@ Documentation/git-pull.adoc: pulling or stash them away with linkgit:git-stash[1
      +	of a remote (see the section <<REMOTES,REMOTES>> below).
      ++
      +Defaults to the configured upstream for the current branch, or `origin`.
     -+See UPSTREAM BRANCHES below for more on how to configure upstreams.
     ++See <<UPSTREAM-BRANCHES,UPSTREAM BRANCHES>> below for more on how to
     ++configure upstreams.
      +
      +<refspec>::
      +	Which branch or other reference(s) to fetch and integrate into the
     @@ Documentation/git-pull.adoc: pulling or stash them away with linkgit:git-stash[1
      +	Defaults to the configured upstream for the current branch.
      ++
      +This can be a branch, tag, or other collection of reference(s).
     -+See <refspec> below under "Options related to fetching" for the full syntax,
     -+and DEFAULT BEHAVIOUR below for how `git pull` uses this argument to
     -+determine which remote branch to integrate.
     ++See <<fetch-refspec,<refspec>>> below under "Options related to fetching"
     ++for the full syntax, and <<DEFAULT-BEHAVIOUR,DEFAULT BEHAVIOUR>> below
     ++for how `git pull` uses this argument to determine which remote branch
     ++to integrate.
      +
       -q::
       --quiet::
       	This is passed to both underlying git-fetch to squelch reporting of
     +@@ Documentation/git-pull.adoc: include::urls-remotes.adoc[]
     + 
     + include::merge-strategies.adoc[]
     + 
     ++[[DEFAULT-BEHAVIOUR]]
     + DEFAULT BEHAVIOUR
     + -----------------
     + 
     +
     + ## Documentation/pull-fetch-param.adoc ##
     +@@ Documentation/pull-fetch-param.adoc: ifndef::git-pull[]
     + 	(See linkgit:git-config[1]).
     + endif::git-pull[]
     + 
     ++[[fetch-refspec]]
     + <refspec>::
     + 	Specifies which refs to fetch and which local refs to update.
     + 	When no <refspec>s appear on the command line, the refs to fetch
 2:  ffbb9d7c6a ! 2:  122774d4cc doc: git-pull: clarify options for integrating remote branch
     @@ Documentation/git-pull.adoc: SYNOPSIS
      -branches.
      +Integrate changes from a remote repository into the current branch.
      +
     -+First, `git pull` runs `git fetch` with the same arguments to fetch
     -+remote branch(es). Then it integrates the remote branch into the current
     -+branch. There are 4 main options for integrating the remote branch:
     ++First, `git pull` runs `git fetch` with the same arguments
     ++(excluding merge options) to fetch remote branch(es).
     ++Then it decides which remote branch to integrate: if you run `git pull`
     ++with no arguments this defaults to the <<UPSTREAM-BRANCHES,upstream>>
     ++for the current branch.
     ++Then it integrates that branch into the current branch.
     ++
     ++There are 4 main options for integrating the remote branch:
      +
      +1. `git pull --ff-only` will only do "fast-forward" updates: it
      +   fails if the remote branch has diverged. This is the default.
 3:  76dc2c19fb ! 3:  323e81f2fd doc: git-pull: delete the example
     @@ Commit message
          Signed-off-by: Julia Evans <julia@jvns.ca>
      
       ## Documentation/git-pull.adoc ##
     -@@ Documentation/git-pull.adoc: branch. There are 4 main options for integrating the remote branch:
     +@@ Documentation/git-pull.adoc: There are 4 main options for integrating the remote branch:
       You can also set the configuration options `pull.rebase`, `pull.squash`,
       or `pull.ff` with your preferred behaviour.
       
 4:  c7f09c2bd3 ! 4:  999dfba156 doc: git-pull: clarify how to exit a conflicted merge
     @@ Commit message
          Signed-off-by: Julia Evans <julia@jvns.ca>
      
       ## Documentation/git-pull.adoc ##
     -@@ Documentation/git-pull.adoc: branch. There are 4 main options for integrating the remote branch:
     +@@ Documentation/git-pull.adoc: There are 4 main options for integrating the remote branch:
       You can also set the configuration options `pull.rebase`, `pull.squash`,
       or `pull.ff` with your preferred behaviour.
       
-- 
gitgitgadget
Julia Evans via GitGitGadget· Oct 8, 2025, 19:25 UTC · re: Julia Evans via GitGitGadget · lore

[PATCH v2 1/4] doc: git-pull: move <repository> and <refspec> params

From: Julia Evans <julia@jvns.ca>
From user feedback:
- it's confusing that we use both <branch> and <refspec> to refer to the
  second argument
- one user is not clear about what `refs/heads/*:refs/remotes/origin/*`
  is meant to be an example of ("is it like a path?")

The DESCRIPTION section is also doing a lot right now: it's trying to describe both how the <repository> and <refspec> arguments work (which is pretty complex, as seen in the DEFAULT BEHAVIOUR section) as well as how `git pull` calls `git fetch` and merge/rebase/etc depending on the arguments.

Handle this by moving the description of the <repository> and <refspec> arguments to the OPTIONS section, so that we can focus on the merge/rebase/etc behaviour in the DESCRIPTION section, and refer folks to the later sections for details.

Use the term "upstream" instead of 'the "remote" and "merge" configuration for the current branch' since users are more likely to know what an "upstream" is.

Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/git-pull.adoc         | 32 +++++++++++++++++++----------
 Documentation/pull-fetch-param.adoc |  1 +
 2 files changed, 22 insertions(+), 11 deletions(-)
Show changes to 2 files +22 −11

Documentation/git-pull.adoc, Documentation/pull-fetch-param.adoc

diff --git a/Documentation/git-pull.adoc b/Documentation/git-pull.adoc
index 48e924a10a..a3d248dd1d 100644
--- a/Documentation/git-pull.adoc
+++ b/Documentation/git-pull.adoc
@@ -27,17 +27,6 @@ and then depending on configuration options or command line flags,
 will call either `git rebase` or `git merge` to reconcile diverging
 branches.
 
-<repository> should be the name of a remote repository as
-passed to linkgit:git-fetch[1].  <refspec> can name an
-arbitrary remote ref (for example, the name of a tag) or even
-a collection of refs with corresponding remote-tracking branches
-(e.g., refs/heads/{asterisk}:refs/remotes/origin/{asterisk}),
-but usually it is the name of a branch in the remote repository.
-
-Default values for <repository> and <branch> are read from the
-"remote" and "merge" configuration for the current branch
-as set by linkgit:git-branch[1] `--track`.
-
 Assume the following history exists and the current branch is
 "`master`":
 
@@ -77,6 +66,26 @@ pulling or stash them away with linkgit:git-stash[1].
 OPTIONS
 -------
 
+<repository>::
+	The "remote" repository to pull from.  This can be either
+	a URL (see the section <<URLS,GIT URLS>> below) or the name
+	of a remote (see the section <<REMOTES,REMOTES>> below).
++
+Defaults to the configured upstream for the current branch, or `origin`.
+See <<UPSTREAM-BRANCHES,UPSTREAM BRANCHES>> below for more on how to
+configure upstreams.
+
+<refspec>::
+	Which branch or other reference(s) to fetch and integrate into the
+	current branch, for example `main` in `git pull origin main`.
+	Defaults to the configured upstream for the current branch.
++
+This can be a branch, tag, or other collection of reference(s).
+See <<fetch-refspec,<refspec>>> below under "Options related to fetching"
+for the full syntax, and <<DEFAULT-BEHAVIOUR,DEFAULT BEHAVIOUR>> below
+for how `git pull` uses this argument to determine which remote branch
+to integrate.
+
 -q::
 --quiet::
 	This is passed to both underlying git-fetch to squelch reporting of
@@ -145,6 +154,7 @@ include::urls-remotes.adoc[]
 
 include::merge-strategies.adoc[]
 
+[[DEFAULT-BEHAVIOUR]]
 DEFAULT BEHAVIOUR
 -----------------
 
diff --git a/Documentation/pull-fetch-param.adoc b/Documentation/pull-fetch-param.adoc
index d79d2f6065..bb2cf6a462 100644
--- a/Documentation/pull-fetch-param.adoc
+++ b/Documentation/pull-fetch-param.adoc
@@ -11,6 +11,7 @@ ifndef::git-pull[]
 	(See linkgit:git-config[1]).
 endif::git-pull[]
 
+[[fetch-refspec]]
 <refspec>::
 	Specifies which refs to fetch and which local refs to update.
 	When no <refspec>s appear on the command line, the refs to fetch
-- 
gitgitgadget
Julia Evans via GitGitGadget· Oct 8, 2025, 19:25 UTC · re: Julia Evans via GitGitGadget · lore

[PATCH v2 2/4] doc: git-pull: clarify options for integrating remote branch

From: Julia Evans <julia@jvns.ca>
From user feedback:
- One user is confused about the current default ("I was convinced that
  the git default was still to merge on pull")
- One user is confused about why "git fetch" isn't mentioned earlier
- One user says they always forget what the arguments to `git pull` are
  and that it's not immediately obvious that `--no-rebase` means "merge"
- One user wants `--ff-only` to be mentioned

Resolve this by listing the options for integrating the the remote branch. This should help users figure out at a glance which one they want to do, and make it clearer that --ff-only is the default.

Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/git-pull.adoc | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)
Show changes to Documentation/git-pull.adoc +19 −11
diff --git a/Documentation/git-pull.adoc b/Documentation/git-pull.adoc
index a3d248dd1d..6e9fa14967 100644
--- a/Documentation/git-pull.adoc
+++ b/Documentation/git-pull.adoc
@@ -15,17 +15,25 @@ SYNOPSIS
 DESCRIPTION
 -----------
 
-Incorporates changes from a remote repository into the current branch.
-If the current branch is behind the remote, then by default it will
-fast-forward the current branch to match the remote.  If the current
-branch and the remote have diverged, the user needs to specify how to
-reconcile the divergent branches with `--rebase` or `--no-rebase` (or
-the corresponding configuration option in `pull.rebase`).
-
-More precisely, `git pull` runs `git fetch` with the given parameters
-and then depending on configuration options or command line flags,
-will call either `git rebase` or `git merge` to reconcile diverging
-branches.
+Integrate changes from a remote repository into the current branch.
+
+First, `git pull` runs `git fetch` with the same arguments
+(excluding merge options) to fetch remote branch(es).
+Then it decides which remote branch to integrate: if you run `git pull`
+with no arguments this defaults to the <<UPSTREAM-BRANCHES,upstream>>
+for the current branch.
+Then it integrates that branch into the current branch.
+
+There are 4 main options for integrating the remote branch:
+
+1. `git pull --ff-only` will only do "fast-forward" updates: it
+   fails if the remote branch has diverged. This is the default.
+2. `git pull --rebase` runs `git rebase`
+3. `git pull --no-rebase` runs `git merge`.
+4. `git pull --squash` runs `git merge --squash`
+
+You can also set the configuration options `pull.rebase`, `pull.squash`,
+or `pull.ff` with your preferred behaviour.
 
 Assume the following history exists and the current branch is
 "`master`":
-- 
gitgitgadget
Junio C Hamano· Oct 8, 2025, 21:33 UTC · re: Julia Evans via GitGitGadget · lore

Re: [PATCH v2 2/4] doc: git-pull: clarify options for integrating remote branch

"Julia Evans via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 12 quoted lines
> +Integrate changes from a remote repository into the current branch.
> +
> +First, `git pull` runs `git fetch` with the same arguments
> +(excluding merge options) to fetch remote branch(es).
> +Then it decides which remote branch to integrate: if you run `git pull`
> +with no arguments this defaults to the <<UPSTREAM-BRANCHES,upstream>>
> +for the current branch.
> +Then it integrates that branch into the current branch.
> +There are 4 main options for integrating the remote branch:
> +
> +1. `git pull --ff-only` will only do "fast-forward" updates: it
> +   fails if the remote branch has diverged. This is the default.

Technically, you can pretend to be the king, the center of the world, and occasionally publish your very latest to the remote by pushing there, and it is technically possible that the remote to diverge from you by somehow acquiring its own commits, so the above is not wrong per-se, but the way it is phrased is a bit awkward.

The operation fails when _you_ diverged from the remote branch.

In other words, you cloned or made yourself in-sync with the remote earlier, the remote may or may not have progressed before your 'pull'. If you created your own commits on top of the state that was in sync with them, you diverged from them and --ff-only is stopped in such a case. If you haven't changed your branch since you were in sync with them the last time, --ff-only would fast-forward your branch to match what they have.

> +2. `git pull --rebase` runs `git rebase`

This technically does not integrate remote branch into our current branch. Rather, the commits on our current branch are integrated on top of their history. That may be worth noting? I dunno.

Show 5 quoted lines
> +3. `git pull --no-rebase` runs `git merge`.
> +4. `git pull --squash` runs `git merge --squash`
> +
> +You can also set the configuration options `pull.rebase`, `pull.squash`,
> +or `pull.ff` with your preferred behaviour.

This part has two orthogonal things, each of which has its own default, which may be a bit confusing. (1) which branch we get from the remote integrates with the current branch. The default is to use the upstream of our current branch. (2) how the integration between the remote thing and our current branch is done. The default is only to accept fast-forward updates.

Perhaps it may help clarify the flow if we said upfront that we describe two orthgonal things? E.g.,

    First it fetches.  Then it decides two things: what to integrage
    with the current branch, and how to do the integration.  By
    default, the upstream branch of the current branch is what gets
    integrated, and by default "pull --ff-only" (described below) is
    how the integration is done.
or something?  I dunno.
Julia Evans· Oct 9, 2025, 21:31 UTC · re: Junio C Hamano · lore

Re: [PATCH v2 2/4] doc: git-pull: clarify options for integrating remote branch

On Wed, Oct 8, 2025, at 5:33 PM, Junio C Hamano wrote:
Show 22 quoted lines
> "Julia Evans via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
>> +Integrate changes from a remote repository into the current branch.
>> +
>> +First, `git pull` runs `git fetch` with the same arguments
>> +(excluding merge options) to fetch remote branch(es).
>> +Then it decides which remote branch to integrate: if you run `git pull`
>> +with no arguments this defaults to the <<UPSTREAM-BRANCHES,upstream>>
>> +for the current branch.
>> +Then it integrates that branch into the current branch.
>> +There are 4 main options for integrating the remote branch:
>> +
>> +1. `git pull --ff-only` will only do "fast-forward" updates: it
>> +   fails if the remote branch has diverged. This is the default.
>
> Technically, you can pretend to be the king, the center of the
> world, and occasionally publish your very latest to the remote by
> pushing there, and it is technically possible that the remote to
> diverge from you by somehow acquiring its own commits, so the above
> is not wrong per-se, but the way it is phrased is a bit awkward.
>
> The operation fails when _you_ diverged from the remote branch.

Thanks, I meant to fix that earlier. Will fix to say "if your local branch has diverged from the remote".

Show 5 quoted lines
>> +2. `git pull --rebase` runs `git rebase`
>
> This technically does not integrate remote branch into our current
> branch.  Rather, the commits on our current branch are integrated
> on top of their history.  That may be worth noting?  I dunno.

At least 2 users who read this also commented that they find the word "integrate" using, for perhaps a similar reason. Specifically, one comment was "unclear if 'integrate' is a technical/specific term or just generic".

My assumption was that the word "integrate" was meant to be a generic way to communicate "combine the changes in the two branches in some unspecified way", and that's how I was using it. I'm not sure what you mean when you say "integrate" (is it "merge"?).

I see a few options here:
1. Try to find a different word that communicates "combine the two
   branches in a way that you have to specify". I'm not sure how
   likely this is to succeed.
2. Instead of using the word "integrate", instead always say something
   like "merge or rebase". I tried this but I found it a bit unwieldy, and
   I think it might also be confusing for users who aren't familiar with
   both merge and rebase, they might worry "do I need to understand
   rebase to use `git pull`?", when of course you don't.
3. Keep the word "integrate".

I'm very open to hearing suggestions here, maybe there's another better way I haven't thought of.

Show 23 quoted lines
>> +3. `git pull --no-rebase` runs `git merge`.
>> +4. `git pull --squash` runs `git merge --squash`
>> +
>> +You can also set the configuration options `pull.rebase`, `pull.squash`,
>> +or `pull.ff` with your preferred behaviour.
>
> This part has two orthogonal things, each of which has its own
> default, which may be a bit confusing.  (1) which branch we get from
> the remote integrates with the current branch.  The default is to
> use the upstream of our current branch.  (2) how the integration
> between the remote thing and our current branch is done.  The
> default is only to accept fast-forward updates.
>
> Perhaps it may help clarify the flow if we said upfront that we
> describe two orthgonal things?  E.g.,
>
>     First it fetches.  Then it decides two things: what to integrage
>     with the current branch, and how to do the integration.  By
>     default, the upstream branch of the current branch is what gets
>     integrated, and by default "pull --ff-only" (described below) is
>     how the integration is done.
>
> or something?  I dunno.

I think I'm happy with how the two different defaults are being described right now, but I'll run this by some folks and see what they think.

Kristoffer Haugsbakk· Oct 9, 2025, 22:20 UTC · re: Julia Evans · lore

Re: [PATCH v2 2/4] doc: git-pull: clarify options for integrating remote branch

On Thu, Oct 9, 2025, at 23:31, Julia Evans wrote:
Show 11 quoted lines
> On Wed, Oct 8, 2025, at 5:33 PM, Junio C Hamano wrote:
>>>[snip]
>>> +2. `git pull --rebase` runs `git rebase`
>>
>> This technically does not integrate remote branch into our current
>> branch.  Rather, the commits on our current branch are integrated
>> on top of their history.  That may be worth noting?  I dunno.
>
> At least 2 users who read this also commented that they find the word
> "integrate" using, for perhaps a similar reason. Specifically, one comment
> was "unclear if 'integrate' is a technical/specific term or just generic".
(confusing)
Show 5 quoted lines
>
> My assumption was that the word "integrate" was meant to be a generic
> way to communicate "combine the changes in the two branches in
> some unspecified way", and that's how I was using it. I'm not sure what
> you mean when you say "integrate" (is it "merge"?).

I wonder if “integration” is like “upstream”; frequently used but not really explained? (see gitworkflows(7); one mention in gitglossary(7)).

I think Martin Fowler has the correct (useful) view on branches:[1]
    In thinking about these patterns, I find it useful to develop two
    main categories. One group looks at integration, how multiple
    developers combine their work into a coherent whole. The other looks
    at the path to production, using branching to help manage the route
    from an integrated code base to a product running in production.
Specifically the first category.
Then later:
    Branching is about managing the interplay of isolation and
    integration. Having everyone work on a single shared codebase all
    the time, doesn't work because I can't compile the program if you're
    in the middle of typing a variable name. So at least to some degree,
    we need a notion of a private workspace that I can work on for a
    while. Modern source code controls tools make it easy to branch and
    monitor changes to those branches. At some point however we need to
    integrate. Thinking about branching strategies is really all about
    deciding how and when we integrate.
🔗 1: https://martinfowler.com/articles/branching-patterns.html

The point of *most* branches ought to be this: you need isolation, but you also want to eventually integrate with upstream, the trunk, or whatever else.

• Everyone working on everything at the same time is chaos
• Everyone working on their own thing in isolation forever is
  Balkanization
• Forking a private space to integrate later in a timely manner strikes
  the right balance
• (Then there are the dozens of variations of long-living forks, private
  forks for the changes that you want to make but few others want...)
So I don’t think that
> "combine the changes in the two branches in some unspecified way"

is quite it, because the direction is towards one integration branch, one upstream, one trunk, main branch (not whichever one).

> way to communicate "combine the changes in the two branches in
> some unspecified way", and that's how I was using it. I'm not sure what

... and regarding “unspecified”: I suspect the contention might be distinction between integrating the branchy itself (with those commits) with replaying fresh commits (rebase). But I don’t know.

>
>[snip]
Junio C Hamano· Oct 9, 2025, 22:41 UTC · re: Julia Evans · lore

Re: [PATCH v2 2/4] doc: git-pull: clarify options for integrating remote branch

"Julia Evans" <julia@jvns.ca> writes:
> My assumption was that the word "integrate" was meant to be a generic
> way to communicate "combine the changes in the two branches in
> some unspecified way", and that's how I was using it.
It is how I was using it, too.
> I'm not sure what
> you mean when you say "integrate" (is it "merge"?).

Not limited to "merge", but I view it more as between two parties, one side supplies changes while the other side serves as a base. A merge looks as if the changes of a side branch gets incorporated into the trunk. A rebase looks as if the changes you have created gets incorporated into the trunk by replaying them onto the trunk.

> 1. Try to find a different word that communicates "combine the two
>    branches in a way that you have to specify". I'm not sure how
>    likely this is to succeed.
I am not particularly good at finding verbs, sorry.
Show 5 quoted lines
> 2. Instead of using the word "integrate", instead always say something
>    like "merge or rebase". I tried this but I found it a bit unwieldy, and
>    I think it might also be confusing for users who aren't familiar with
>    both merge and rebase, they might worry "do I need to understand
>    rebase to use `git pull`?", when of course you don't.
Very true.
Julia Evans via GitGitGadget· Oct 8, 2025, 19:25 UTC · re: Julia Evans via GitGitGadget · lore

[PATCH v2 3/4] doc: git-pull: delete the example

From: Julia Evans <julia@jvns.ca>

From user feedback: this example is confusing because it implies that `git pull` will run `git merge` by default, but the default is `--ff-only`.

We could instead show an example of a fast-forward merge, but that may not add a lot since fast-forward merges are relatively simple. This lets us keep the description short.

Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/git-pull.adoc | 26 --------------------------
 1 file changed, 26 deletions(-)
Show changes to Documentation/git-pull.adoc +0 −22
diff --git a/Documentation/git-pull.adoc b/Documentation/git-pull.adoc
index 6e9fa14967..dc93e5e6d7 100644
--- a/Documentation/git-pull.adoc
+++ b/Documentation/git-pull.adoc
@@ -35,32 +35,6 @@ There are 4 main options for integrating the remote branch:
 You can also set the configuration options `pull.rebase`, `pull.squash`,
 or `pull.ff` with your preferred behaviour.
 
-Assume the following history exists and the current branch is
-"`master`":
-
-------------
-	  A---B---C master on origin
-	 /
-    D---E---F---G master
-	^
-	origin/master in your repository
-------------
-
-Then "`git pull`" will fetch and replay the changes from the remote
-`master` branch since it diverged from the local `master` (i.e., `E`)
-until its current commit (`C`) on top of `master` and record the
-result in a new commit along with the names of the two parent commits
-and a log message from the user describing the changes.
-
-------------
-	  A---B---C origin/master
-	 /         \
-    D---E---F---G---H master
-------------
-
-See linkgit:git-merge[1] for details, including how conflicts
-are presented and handled.
-
 In Git 1.7.0 or later, to cancel a conflicting merge, use
 `git reset --merge`.  *Warning*: In older versions of Git, running 'git pull'
 with uncommitted changes is discouraged: while possible, it leaves you
-- 
gitgitgadget
Julia Evans via GitGitGadget· Oct 8, 2025, 19:25 UTC · re: Julia Evans via GitGitGadget · lore

[PATCH v2 4/4] doc: git-pull: clarify how to exit a conflicted merge

From: Julia Evans <julia@jvns.ca>
From user feedback:
- One user is confused about why `git reset --merge`
  (why not just `git reset`?). Handle this by mentioning
  `git merge --abort` and `git reset --abort` instead, which have a
  more obvious meaning.
- 2 users want to know what "In older versions of Git" means exactly
  (in versions older than 1.7.0). Handle this by removing the warning
  since it was added 15 years ago (in 3f8fc184c0e2c)
Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/git-pull.adoc | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
Show changes to Documentation/git-pull.adoc +3 −9
diff --git a/Documentation/git-pull.adoc b/Documentation/git-pull.adoc
index dc93e5e6d7..8d286425d6 100644
--- a/Documentation/git-pull.adoc
+++ b/Documentation/git-pull.adoc
@@ -35,15 +35,9 @@ There are 4 main options for integrating the remote branch:
 You can also set the configuration options `pull.rebase`, `pull.squash`,
 or `pull.ff` with your preferred behaviour.
 
-In Git 1.7.0 or later, to cancel a conflicting merge, use
-`git reset --merge`.  *Warning*: In older versions of Git, running 'git pull'
-with uncommitted changes is discouraged: while possible, it leaves you
-in a state that may be hard to back out of in the case of a conflict.
-
-If any of the remote changes overlap with local uncommitted changes,
-the merge will be automatically canceled and the work tree untouched.
-It is generally best to get any local changes in working order before
-pulling or stash them away with linkgit:git-stash[1].
+If there's a merge conflict during the merge or rebase that you don't
+want to handle, you can safely abort it with `git merge --abort` or `git
+--rebase abort`.
 
 OPTIONS
 -------
-- 
gitgitgadget
Julia Evans via GitGitGadget· Oct 15, 2025, 13:13 UTC · re: Julia Evans via GitGitGadget · lore

[PATCH v3 0/4] doc: git-pull: clarify DESCRIPTION section

I got feedback from 15 Git users on the current git pull man page, using this tool: https://text-feedback.wizardzines.com/git-pull.

My goals here are to be clear about the relationship between git pull and fetch/merge/rebase etc, make sure users know the current default for git pull (--ff-only) since some folks still remember the old default, and to help users quickly figure out what command they need to run to merge/rebase/squash/etc.

I've taken a pretty aggressive approach because I think it's possible to have a pretty short and focused DESCRIPTION section here while keeping the most important info. Open to hearing that I've removed too much.

This references the UPSTREAM BRANCHES section from https://lore.kernel.org/git/0ec629d4037bf5d1ccc248ca1bbd87ccc08119a3.1757703309.git.gitgitgadget@gmail.com/ , so if that isn't merged I'll need to revisit the approach here.

changes in v2:
 * Add "(excluding merge options)" to clarify which options are passed to
   git fetch (from Chris's review)
 * Say that git pull will by default merge the upstream branch. (from
   Chris's review)
 * Add some links to the UPSTREAM BRANCHES section, and to the <refspec>
   section in git fetch, to make it easier to navigate in the HTML version
   of the docs at least. The situation where we repeat the <repository> part
   in git fetch is weird but I don't have a better idea for how to handle it
   right now. The UPSTREAM BRANCHES links are currently failing the
   documentation tests, but should pass once the patch series that adds that
   is merged. (from Ben's review)
changes in v3:

Change "fails if the local branch has diverged" to say "remote branch has diverged", from Junio's review.

I did not come up with a better idea for a word to use than "integrate" so left that alone.

Julia Evans (4):
  doc: git-pull: move <repository> and <refspec> params
  doc: git-pull: clarify options for integrating remote branch
  doc: git-pull: delete the example
  doc: git-pull: clarify how to exit a conflicted merge
 Documentation/git-pull.adoc         | 93 +++++++++++++----------------
 Documentation/pull-fetch-param.adoc |  1 +
 2 files changed, 41 insertions(+), 53 deletions(-)
base-commit: ca2559c1d630eb4f04cdee2328aaf1c768907a9e
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1976%2Fjvns%2Fclarify-pull-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1976/jvns/clarify-pull-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/1976
Range-diff vs v2:
 1:  4cc87ec354 = 1:  96b2673e04 doc: git-pull: move <repository> and <refspec> params
 2:  122774d4cc ! 2:  0ff00b4ff6 doc: git-pull: clarify options for integrating remote branch
     @@ Documentation/git-pull.adoc: SYNOPSIS
      +There are 4 main options for integrating the remote branch:
      +
      +1. `git pull --ff-only` will only do "fast-forward" updates: it
     -+   fails if the remote branch has diverged. This is the default.
     ++   fails if your local branch has diverged from the remote branch.
     ++   This is the default.
      +2. `git pull --rebase` runs `git rebase`
      +3. `git pull --no-rebase` runs `git merge`.
      +4. `git pull --squash` runs `git merge --squash`
 3:  323e81f2fd = 3:  2439c3d847 doc: git-pull: delete the example
 4:  999dfba156 = 4:  2236dac4e4 doc: git-pull: clarify how to exit a conflicted merge
-- 
gitgitgadget
Julia Evans via GitGitGadget· Oct 15, 2025, 13:13 UTC · re: Julia Evans via GitGitGadget · lore

[PATCH v3 1/4] doc: git-pull: move <repository> and <refspec> params

From: Julia Evans <julia@jvns.ca>
From user feedback:
- it's confusing that we use both <branch> and <refspec> to refer to the
  second argument
- one user is not clear about what `refs/heads/*:refs/remotes/origin/*`
  is meant to be an example of ("is it like a path?")

The DESCRIPTION section is also doing a lot right now: it's trying to describe both how the <repository> and <refspec> arguments work (which is pretty complex, as seen in the DEFAULT BEHAVIOUR section) as well as how `git pull` calls `git fetch` and merge/rebase/etc depending on the arguments.

Handle this by moving the description of the <repository> and <refspec> arguments to the OPTIONS section, so that we can focus on the merge/rebase/etc behaviour in the DESCRIPTION section, and refer folks to the later sections for details.

Use the term "upstream" instead of 'the "remote" and "merge" configuration for the current branch' since users are more likely to know what an "upstream" is.

Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/git-pull.adoc         | 32 +++++++++++++++++++----------
 Documentation/pull-fetch-param.adoc |  1 +
 2 files changed, 22 insertions(+), 11 deletions(-)
Show changes to 2 files +22 −11

Documentation/git-pull.adoc, Documentation/pull-fetch-param.adoc

diff --git a/Documentation/git-pull.adoc b/Documentation/git-pull.adoc
index 48e924a10a..a3d248dd1d 100644
--- a/Documentation/git-pull.adoc
+++ b/Documentation/git-pull.adoc
@@ -27,17 +27,6 @@ and then depending on configuration options or command line flags,
 will call either `git rebase` or `git merge` to reconcile diverging
 branches.
 
-<repository> should be the name of a remote repository as
-passed to linkgit:git-fetch[1].  <refspec> can name an
-arbitrary remote ref (for example, the name of a tag) or even
-a collection of refs with corresponding remote-tracking branches
-(e.g., refs/heads/{asterisk}:refs/remotes/origin/{asterisk}),
-but usually it is the name of a branch in the remote repository.
-
-Default values for <repository> and <branch> are read from the
-"remote" and "merge" configuration for the current branch
-as set by linkgit:git-branch[1] `--track`.
-
 Assume the following history exists and the current branch is
 "`master`":
 
@@ -77,6 +66,26 @@ pulling or stash them away with linkgit:git-stash[1].
 OPTIONS
 -------
 
+<repository>::
+	The "remote" repository to pull from.  This can be either
+	a URL (see the section <<URLS,GIT URLS>> below) or the name
+	of a remote (see the section <<REMOTES,REMOTES>> below).
++
+Defaults to the configured upstream for the current branch, or `origin`.
+See <<UPSTREAM-BRANCHES,UPSTREAM BRANCHES>> below for more on how to
+configure upstreams.
+
+<refspec>::
+	Which branch or other reference(s) to fetch and integrate into the
+	current branch, for example `main` in `git pull origin main`.
+	Defaults to the configured upstream for the current branch.
++
+This can be a branch, tag, or other collection of reference(s).
+See <<fetch-refspec,<refspec>>> below under "Options related to fetching"
+for the full syntax, and <<DEFAULT-BEHAVIOUR,DEFAULT BEHAVIOUR>> below
+for how `git pull` uses this argument to determine which remote branch
+to integrate.
+
 -q::
 --quiet::
 	This is passed to both underlying git-fetch to squelch reporting of
@@ -145,6 +154,7 @@ include::urls-remotes.adoc[]
 
 include::merge-strategies.adoc[]
 
+[[DEFAULT-BEHAVIOUR]]
 DEFAULT BEHAVIOUR
 -----------------
 
diff --git a/Documentation/pull-fetch-param.adoc b/Documentation/pull-fetch-param.adoc
index d79d2f6065..bb2cf6a462 100644
--- a/Documentation/pull-fetch-param.adoc
+++ b/Documentation/pull-fetch-param.adoc
@@ -11,6 +11,7 @@ ifndef::git-pull[]
 	(See linkgit:git-config[1]).
 endif::git-pull[]
 
+[[fetch-refspec]]
 <refspec>::
 	Specifies which refs to fetch and which local refs to update.
 	When no <refspec>s appear on the command line, the refs to fetch
-- 
gitgitgadget
Julia Evans via GitGitGadget· Oct 15, 2025, 13:13 UTC · re: Julia Evans via GitGitGadget · lore

[PATCH v3 2/4] doc: git-pull: clarify options for integrating remote branch

From: Julia Evans <julia@jvns.ca>
From user feedback:
- One user is confused about the current default ("I was convinced that
  the git default was still to merge on pull")
- One user is confused about why "git fetch" isn't mentioned earlier
- One user says they always forget what the arguments to `git pull` are
  and that it's not immediately obvious that `--no-rebase` means "merge"
- One user wants `--ff-only` to be mentioned

Resolve this by listing the options for integrating the the remote branch. This should help users figure out at a glance which one they want to do, and make it clearer that --ff-only is the default.

Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/git-pull.adoc | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)
Show changes to Documentation/git-pull.adoc +20 −11
diff --git a/Documentation/git-pull.adoc b/Documentation/git-pull.adoc
index a3d248dd1d..0686a9d666 100644
--- a/Documentation/git-pull.adoc
+++ b/Documentation/git-pull.adoc
@@ -15,17 +15,26 @@ SYNOPSIS
 DESCRIPTION
 -----------
 
-Incorporates changes from a remote repository into the current branch.
-If the current branch is behind the remote, then by default it will
-fast-forward the current branch to match the remote.  If the current
-branch and the remote have diverged, the user needs to specify how to
-reconcile the divergent branches with `--rebase` or `--no-rebase` (or
-the corresponding configuration option in `pull.rebase`).
-
-More precisely, `git pull` runs `git fetch` with the given parameters
-and then depending on configuration options or command line flags,
-will call either `git rebase` or `git merge` to reconcile diverging
-branches.
+Integrate changes from a remote repository into the current branch.
+
+First, `git pull` runs `git fetch` with the same arguments
+(excluding merge options) to fetch remote branch(es).
+Then it decides which remote branch to integrate: if you run `git pull`
+with no arguments this defaults to the <<UPSTREAM-BRANCHES,upstream>>
+for the current branch.
+Then it integrates that branch into the current branch.
+
+There are 4 main options for integrating the remote branch:
+
+1. `git pull --ff-only` will only do "fast-forward" updates: it
+   fails if your local branch has diverged from the remote branch.
+   This is the default.
+2. `git pull --rebase` runs `git rebase`
+3. `git pull --no-rebase` runs `git merge`.
+4. `git pull --squash` runs `git merge --squash`
+
+You can also set the configuration options `pull.rebase`, `pull.squash`,
+or `pull.ff` with your preferred behaviour.
 
 Assume the following history exists and the current branch is
 "`master`":
-- 
gitgitgadget
Julia Evans via GitGitGadget· Oct 15, 2025, 13:13 UTC · re: Julia Evans via GitGitGadget · lore

[PATCH v3 3/4] doc: git-pull: delete the example

From: Julia Evans <julia@jvns.ca>

From user feedback: this example is confusing because it implies that `git pull` will run `git merge` by default, but the default is `--ff-only`.

We could instead show an example of a fast-forward merge, but that may not add a lot since fast-forward merges are relatively simple. This lets us keep the description short.

Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/git-pull.adoc | 26 --------------------------
 1 file changed, 26 deletions(-)
Show changes to Documentation/git-pull.adoc +0 −22
diff --git a/Documentation/git-pull.adoc b/Documentation/git-pull.adoc
index 0686a9d666..273172aa80 100644
--- a/Documentation/git-pull.adoc
+++ b/Documentation/git-pull.adoc
@@ -36,32 +36,6 @@ There are 4 main options for integrating the remote branch:
 You can also set the configuration options `pull.rebase`, `pull.squash`,
 or `pull.ff` with your preferred behaviour.
 
-Assume the following history exists and the current branch is
-"`master`":
-
-------------
-	  A---B---C master on origin
-	 /
-    D---E---F---G master
-	^
-	origin/master in your repository
-------------
-
-Then "`git pull`" will fetch and replay the changes from the remote
-`master` branch since it diverged from the local `master` (i.e., `E`)
-until its current commit (`C`) on top of `master` and record the
-result in a new commit along with the names of the two parent commits
-and a log message from the user describing the changes.
-
-------------
-	  A---B---C origin/master
-	 /         \
-    D---E---F---G---H master
-------------
-
-See linkgit:git-merge[1] for details, including how conflicts
-are presented and handled.
-
 In Git 1.7.0 or later, to cancel a conflicting merge, use
 `git reset --merge`.  *Warning*: In older versions of Git, running 'git pull'
 with uncommitted changes is discouraged: while possible, it leaves you
-- 
gitgitgadget
Julia Evans via GitGitGadget· Oct 15, 2025, 13:13 UTC · re: Julia Evans via GitGitGadget · lore

[PATCH v3 4/4] doc: git-pull: clarify how to exit a conflicted merge

From: Julia Evans <julia@jvns.ca>
From user feedback:
- One user is confused about why `git reset --merge`
  (why not just `git reset`?). Handle this by mentioning
  `git merge --abort` and `git reset --abort` instead, which have a
  more obvious meaning.
- 2 users want to know what "In older versions of Git" means exactly
  (in versions older than 1.7.0). Handle this by removing the warning
  since it was added 15 years ago (in 3f8fc184c0e2c)
Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/git-pull.adoc | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
Show changes to Documentation/git-pull.adoc +3 −9
diff --git a/Documentation/git-pull.adoc b/Documentation/git-pull.adoc
index 273172aa80..cd3bbc90e3 100644
--- a/Documentation/git-pull.adoc
+++ b/Documentation/git-pull.adoc
@@ -36,15 +36,9 @@ There are 4 main options for integrating the remote branch:
 You can also set the configuration options `pull.rebase`, `pull.squash`,
 or `pull.ff` with your preferred behaviour.
 
-In Git 1.7.0 or later, to cancel a conflicting merge, use
-`git reset --merge`.  *Warning*: In older versions of Git, running 'git pull'
-with uncommitted changes is discouraged: while possible, it leaves you
-in a state that may be hard to back out of in the case of a conflict.
-
-If any of the remote changes overlap with local uncommitted changes,
-the merge will be automatically canceled and the work tree untouched.
-It is generally best to get any local changes in working order before
-pulling or stash them away with linkgit:git-stash[1].
+If there's a merge conflict during the merge or rebase that you don't
+want to handle, you can safely abort it with `git merge --abort` or `git
+--rebase abort`.
 
 OPTIONS
 -------
-- 
gitgitgadget
Ben Knoble· Oct 15, 2025, 16:56 UTC · re: Julia Evans via GitGitGadget · lore

Re: [PATCH v3 0/4] doc: git-pull: clarify DESCRIPTION section

Show 40 quoted lines
> Le 15 oct. 2025 à 09:13, Julia Evans via GitGitGadget <gitgitgadget@gmail.com> a écrit :
> 
> I got feedback from 15 Git users on the current git pull man page, using
> this tool: https://text-feedback.wizardzines.com/git-pull.
> 
> My goals here are to be clear about the relationship between git pull and
> fetch/merge/rebase etc, make sure users know the current default for git
> pull (--ff-only) since some folks still remember the old default, and to
> help users quickly figure out what command they need to run to
> merge/rebase/squash/etc.
> 
> I've taken a pretty aggressive approach because I think it's possible to
> have a pretty short and focused DESCRIPTION section here while keeping the
> most important info. Open to hearing that I've removed too much.
> 
> This references the UPSTREAM BRANCHES section from
> https://lore.kernel.org/git/0ec629d4037bf5d1ccc248ca1bbd87ccc08119a3.1757703309.git.gitgitgadget@gmail.com/
> , so if that isn't merged I'll need to revisit the approach here.
> 
> changes in v2:
> 
> * Add "(excluding merge options)" to clarify which options are passed to
>   git fetch (from Chris's review)
> * Say that git pull will by default merge the upstream branch. (from
>   Chris's review)
> * Add some links to the UPSTREAM BRANCHES section, and to the <refspec>
>   section in git fetch, to make it easier to navigate in the HTML version
>   of the docs at least. The situation where we repeat the <repository> part
>   in git fetch is weird but I don't have a better idea for how to handle it
>   right now. The UPSTREAM BRANCHES links are currently failing the
>   documentation tests, but should pass once the patch series that adds that
>   is merged. (from Ben's review)
> 
> changes in v3:
> 
> Change "fails if the local branch has diverged" to say "remote branch has
> diverged", from Junio's review.
> 
> I did not come up with a better idea for a word to use than "integrate" so
> left that alone.
I’m happy with this version ; anyone else ?
Junio C Hamano· Oct 15, 2025, 20:36 UTC · re: Julia Evans via GitGitGadget · lore

Re: [PATCH v3 0/4] doc: git-pull: clarify DESCRIPTION section

"Julia Evans via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 16 quoted lines
> I got feedback from 15 Git users on the current git pull man page, using
> this tool: https://text-feedback.wizardzines.com/git-pull.
>
> My goals here are to be clear about the relationship between git pull and
> fetch/merge/rebase etc, make sure users know the current default for git
> pull (--ff-only) since some folks still remember the old default, and to
> help users quickly figure out what command they need to run to
> merge/rebase/squash/etc.
>
> I've taken a pretty aggressive approach because I think it's possible to
> have a pretty short and focused DESCRIPTION section here while keeping the
> most important info. Open to hearing that I've removed too much.
>
> This references the UPSTREAM BRANCHES section from
> https://lore.kernel.org/git/0ec629d4037bf5d1ccc248ca1bbd87ccc08119a3.1757703309.git.gitgitgadget@gmail.com/
> , so if that isn't merged I'll need to revisit the approach here.

Looking good. I have no more comments on this series at this moment.

Shall I mark the topic for 'next' now?
Thanks.

← back to recent threads