Skip to content

Commit 0e74643

Browse files
committed
Merge branch 'je/doc-pull'
Documentation updates. * je/doc-pull: doc: git-pull: clarify how to exit a conflicted merge doc: git-pull: delete the example doc: git-pull: clarify options for integrating remote branch doc: git-pull: move <repository> and <refspec> params
2 parents 98401c1 + e9d221b commit 0e74643

File tree

2 files changed

+41
-53
lines changed

2 files changed

+41
-53
lines changed

Documentation/git-pull.adoc

Lines changed: 40 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -15,68 +15,54 @@ 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.
29-
30-
<repository> should be the name of a remote repository as
31-
passed to linkgit:git-fetch[1]. <refspec> can name an
32-
arbitrary remote ref (for example, the name of a tag) or even
33-
a collection of refs with corresponding remote-tracking branches
34-
(e.g., refs/heads/{asterisk}:refs/remotes/origin/{asterisk}),
35-
but usually it is the name of a branch in the remote repository.
36-
37-
Default values for <repository> and <branch> are read from the
38-
"remote" and "merge" configuration for the current branch
39-
as set by linkgit:git-branch[1] `--track`.
40-
41-
Assume the following history exists and the current branch is
42-
"`master`":
18+
Integrate changes from a remote repository into the current branch.
4319

44-
------------
45-
A---B---C master on origin
46-
/
47-
D---E---F---G master
48-
^
49-
origin/master in your repository
50-
------------
20+
First, `git pull` runs `git fetch` with the same arguments
21+
(excluding merge options) to fetch remote branch(es).
22+
Then it decides which remote branch to integrate: if you run `git pull`
23+
with no arguments this defaults to the <<UPSTREAM-BRANCHES,upstream>>
24+
for the current branch.
25+
Then it integrates that branch into the current branch.
5126

52-
Then "`git pull`" will fetch and replay the changes from the remote
53-
`master` branch since it diverged from the local `master` (i.e., `E`)
54-
until its current commit (`C`) on top of `master` and record the
55-
result in a new commit along with the names of the two parent commits
56-
and a log message from the user describing the changes.
57-
58-
------------
59-
A---B---C origin/master
60-
/ \
61-
D---E---F---G---H master
62-
------------
27+
There are 4 main options for integrating the remote branch:
6328

64-
See linkgit:git-merge[1] for details, including how conflicts
65-
are presented and handled.
29+
1. `git pull --ff-only` will only do "fast-forward" updates: it
30+
fails if your local branch has diverged from the remote branch.
31+
This is the default.
32+
2. `git pull --rebase` runs `git rebase`
33+
3. `git pull --no-rebase` runs `git merge`.
34+
4. `git pull --squash` runs `git merge --squash`
6635
67-
In Git 1.7.0 or later, to cancel a conflicting merge, use
68-
`git reset --merge`. *Warning*: In older versions of Git, running 'git pull'
69-
with uncommitted changes is discouraged: while possible, it leaves you
70-
in a state that may be hard to back out of in the case of a conflict.
36+
You can also set the configuration options `pull.rebase`, `pull.squash`,
37+
or `pull.ff` with your preferred behaviour.
7138

72-
If any of the remote changes overlap with local uncommitted changes,
73-
the merge will be automatically canceled and the work tree untouched.
74-
It is generally best to get any local changes in working order before
75-
pulling or stash them away with linkgit:git-stash[1].
39+
If there's a merge conflict during the merge or rebase that you don't
40+
want to handle, you can safely abort it with `git merge --abort` or `git
41+
--rebase abort`.
7642

7743
OPTIONS
7844
-------
7945

46+
<repository>::
47+
The "remote" repository to pull from. This can be either
48+
a URL (see the section <<URLS,GIT URLS>> below) or the name
49+
of a remote (see the section <<REMOTES,REMOTES>> below).
50+
+
51+
Defaults to the configured upstream for the current branch, or `origin`.
52+
See <<UPSTREAM-BRANCHES,UPSTREAM BRANCHES>> below for more on how to
53+
configure upstreams.
54+
55+
<refspec>::
56+
Which branch or other reference(s) to fetch and integrate into the
57+
current branch, for example `main` in `git pull origin main`.
58+
Defaults to the configured upstream for the current branch.
59+
+
60+
This can be a branch, tag, or other collection of reference(s).
61+
See <<fetch-refspec,<refspec>>> below under "Options related to fetching"
62+
for the full syntax, and <<DEFAULT-BEHAVIOUR,DEFAULT BEHAVIOUR>> below
63+
for how `git pull` uses this argument to determine which remote branch
64+
to integrate.
65+
8066
-q::
8167
--quiet::
8268
This is passed to both underlying git-fetch to squelch reporting of
@@ -145,6 +131,7 @@ include::urls-remotes.adoc[]
145131

146132
include::merge-strategies.adoc[]
147133

134+
[[DEFAULT-BEHAVIOUR]]
148135
DEFAULT BEHAVIOUR
149136
-----------------
150137

Documentation/pull-fetch-param.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ifndef::git-pull[]
1111
(See linkgit:git-config[1]).
1212
endif::git-pull[]
1313

14+
[[fetch-refspec]]
1415
<refspec>::
1516
Specifies which refs to fetch and which local refs to update.
1617
When no <refspec>s appear on the command line, the refs to fetch

0 commit comments

Comments
 (0)