Skip to content

Commit 4f6c501

Browse files
committed
doc: git-pull: clarify options for integrating remote branch
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 <[email protected]>
1 parent 5a9c9fe commit 4f6c501

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

Documentation/git-pull.adoc

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,20 @@ SYNOPSIS
1515
DESCRIPTION
1616
-----------
1717

18-
Incorporates changes from a remote repository into the current branch.
19-
If the current branch is behind the remote, then by default it will
20-
fast-forward the current branch to match the remote. If the current
21-
branch and the remote have diverged, the user needs to specify how to
22-
reconcile the divergent branches with `--rebase` or `--no-rebase` (or
23-
the corresponding configuration option in `pull.rebase`).
24-
25-
More precisely, `git pull` runs `git fetch` with the given parameters
26-
and then depending on configuration options or command line flags,
27-
will call either `git rebase` or `git merge` to reconcile diverging
28-
branches.
18+
Integrate changes from a remote repository into the current branch.
19+
20+
First, `git pull` runs `git fetch` with the same arguments to fetch
21+
remote branch(es). Then it integrates the remote branch into the current
22+
branch. There are 4 main options for integrating the remote branch:
23+
24+
1. `git pull --ff-only` will only do "fast-forward" updates: it
25+
fails if the remote branch has diverged. This is the default.
26+
2. `git pull --rebase` runs `git rebase`
27+
3. `git pull --no-rebase` runs `git merge`.
28+
4. `git pull --squash` runs `git merge --squash`
29+
30+
You can also set the configuration options `pull.rebase`, `pull.squash`,
31+
or `pull.ff` with your preferred behaviour.
2932

3033
Assume the following history exists and the current branch is
3134
"`master`":

0 commit comments

Comments
 (0)