LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

git-pull

Fetch and integrate remote changes

TLDR

Pull from origin
$ git pull
copy
Pull from specific remote
$ git pull [remote]
copy
Pull specific branch
$ git pull [remote] [branch]
copy
Pull with rebase
$ git pull --rebase
copy
Pull all remotes
$ git pull --all
copy
Pull without committing merge
$ git pull --no-commit
copy
Pull with fast-forward only
$ git pull --ff-only
copy

SYNOPSIS

git pull [options] [remote] [branch]

DESCRIPTION

git pull fetches from a remote and integrates the changes with the current branch. It is equivalent to running `git fetch` followed by `git merge`, or `git rebase` when the `--rebase` option is used.
Pull strategies vary by workflow. Some teams prefer merge (preserving all history), others prefer rebase (linear history), and some use `--ff-only` to reject non-fast-forward updates and prevent unexpected merge commits. The `pull.rebase` configuration setting controls default behavior.

PARAMETERS

--rebase[=true|merges|false]

Rebase current branch on top of upstream after fetching instead of merging.
--no-rebase
Merge upstream into current branch (overrides `pull.rebase` config).
--ff-only
Only update if fast-forward is possible, fail otherwise.
--no-ff
Always create a merge commit, even when fast-forward is possible.
--no-commit
Perform the merge but stop before creating a commit.
--squash
Squash all fetched commits into a single commit on the current branch.
--all
Fetch from all remotes.
--autostash
Automatically stash and reapply uncommitted changes.
--set-upstream
Add upstream tracking reference for the pulled branch.
--depth n
Limit fetch to specified number of commits from remote tip.
-t, --tags
Fetch all tags from the remote.
-q, --quiet
Suppress output during fetch and merge.
-v, --verbose
Be verbose.

CAVEATS

Pulling into a dirty working tree can cause conflicts. Use `--autostash` to automatically stash and reapply local changes. The default merge-or-rebase behavior is controlled by the `pull.rebase` configuration setting. Since Git 2.27, `git pull` warns if `pull.rebase` is not set.

HISTORY

git pull has been part of Git since its initial release by Linus Torvalds in 2005. The `--ff-only` option was added in Git 1.6.6. The `--autostash` option was added in Git 2.9.

SEE ALSO

Copied to clipboard
Kai