mirror of
https://github.com/git/git.git
synced 2025-12-18 12:00:25 +01:00
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
This commit is contained in:
@@ -15,68 +15,54 @@ SYNOPSIS
|
|||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
Incorporates changes from a remote repository into the current branch.
|
Integrate 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
|
First, `git pull` runs `git fetch` with the same arguments
|
||||||
and then depending on configuration options or command line flags,
|
(excluding merge options) to fetch remote branch(es).
|
||||||
will call either `git rebase` or `git merge` to reconcile diverging
|
Then it decides which remote branch to integrate: if you run `git pull`
|
||||||
branches.
|
with no arguments this defaults to the <<UPSTREAM-BRANCHES,upstream>>
|
||||||
|
for the current branch.
|
||||||
|
Then it integrates that branch into the current branch.
|
||||||
|
|
||||||
<repository> should be the name of a remote repository as
|
There are 4 main options for integrating the remote branch:
|
||||||
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
|
1. `git pull --ff-only` will only do "fast-forward" updates: it
|
||||||
"remote" and "merge" configuration for the current branch
|
fails if your local branch has diverged from the remote branch.
|
||||||
as set by linkgit:git-branch[1] `--track`.
|
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`
|
||||||
|
|
||||||
Assume the following history exists and the current branch is
|
You can also set the configuration options `pull.rebase`, `pull.squash`,
|
||||||
"`master`":
|
or `pull.ff` with your preferred behaviour.
|
||||||
|
|
||||||
------------
|
If there's a merge conflict during the merge or rebase that you don't
|
||||||
A---B---C master on origin
|
want to handle, you can safely abort it with `git merge --abort` or `git
|
||||||
/
|
--rebase abort`.
|
||||||
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
|
|
||||||
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].
|
|
||||||
|
|
||||||
OPTIONS
|
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::
|
-q::
|
||||||
--quiet::
|
--quiet::
|
||||||
This is passed to both underlying git-fetch to squelch reporting of
|
This is passed to both underlying git-fetch to squelch reporting of
|
||||||
@@ -145,6 +131,7 @@ include::urls-remotes.adoc[]
|
|||||||
|
|
||||||
include::merge-strategies.adoc[]
|
include::merge-strategies.adoc[]
|
||||||
|
|
||||||
|
[[DEFAULT-BEHAVIOUR]]
|
||||||
DEFAULT BEHAVIOUR
|
DEFAULT BEHAVIOUR
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ ifndef::git-pull[]
|
|||||||
(See linkgit:git-config[1]).
|
(See linkgit:git-config[1]).
|
||||||
endif::git-pull[]
|
endif::git-pull[]
|
||||||
|
|
||||||
|
[[fetch-refspec]]
|
||||||
<refspec>::
|
<refspec>::
|
||||||
Specifies which refs to fetch and which local refs to update.
|
Specifies which refs to fetch and which local refs to update.
|
||||||
When no <refspec>s appear on the command line, the refs to fetch
|
When no <refspec>s appear on the command line, the refs to fetch
|
||||||
|
|||||||
Reference in New Issue
Block a user