Home Explore Blog CI



git

1st chunk of `Documentation/git-pull.adoc`
d71b76446dd5ef22162c6df9a6dddcc76387048a93ceea960000000100000fa2
git-pull(1)
===========

NAME
----
git-pull - Fetch from and integrate with another repository or a local branch


SYNOPSIS
--------
[verse]
'git pull' [<options>] [<repository> [<refspec>...]]


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.

<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`":

------------
	  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
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
-------

-q::
--quiet::
	This is passed to both underlying git-fetch to squelch reporting of
	during transfer, and underlying git-merge to squelch output during
	merging.

-v::
--verbose::
	Pass --verbose to git-fetch and git-merge.

--[no-]recurse-submodules[=(yes|on-demand|no)]::
	This option controls if new commits of populated submodules should
	be fetched, and if the working trees of active submodules should be
	updated, too (see linkgit:git-fetch[1], linkgit:git-config[1] and
	linkgit:gitmodules[5]).
+
If the checkout is done via rebase, local submodule commits are rebased as well.
+
If the update is done via merge, the submodule conflicts are resolved and checked out.

Options related to merging
~~~~~~~~~~~~~~~~~~~~~~~~~~

:git-pull: 1

include::merge-options.adoc[]

-r::
--rebase[=(false|true|merges|interactive)]::
	When true, rebase the current branch on top of the upstream
	branch after fetching. If there is a remote-tracking branch
	corresponding to the upstream branch and the upstream branch
	was rebased since last fetched, the rebase uses that information
	to avoid rebasing non-local changes.
+
When set to `merges`, rebase using `git rebase --rebase-merges` so that
the local merge commits are included in the rebase (see
linkgit:git-rebase[1] for details).
+
When false, merge the upstream branch into the current branch.
+
When

Title: Git Pull Command
Summary
The git-pull command fetches changes from a remote repository and integrates them into the current branch, allowing for fast-forwarding or rebasing of divergent branches, with various options for customizing the merge process.