English ▾ Topics ▾ Version 2.53.0 ▾ git-pull last updated in 2.55.0

NAME

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

SYNOPSIS

git pull [<options>] [<repository> [<refspec>…​]]

DESCRIPTION

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

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

<repository>

The "remote" repository to pull from. This can be either a URL (see the section GIT URLS below) or the name of a remote (see the section 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