git pull
The command that fetches from the upstream remote and then merges (or, if configured, rebases) the new commits into your current branch.
In more detail
git pull is git fetch followed by git merge. When you have no local commits it simply fast-forwards; otherwise it creates a merge commit, or replays your work if pull.rebase is true. Fetch first when you want to look before anything changes.
Example
git pullRelated terms
- git fetch — The command that downloads new commits and refs from a remote and updates your remote-tracking branches, without changing your own branches or files.
- merge — Combining the work of two branches into one, either by moving a branch forward (a fast-forward) or by recording a merge commit.
- pull.rebase — The setting that decides whether git pull joins incoming work with a merge (false) or by rebasing your commits on top (true).
- upstream branch — The remote branch your local branch is linked to, which git push, git pull and git status use when you do not name one.
Taught in
- Clone, Forks, Push, And The Upstream Branch — Advanced Git Internals & Distributed Workflows
- Fetch Is Not Pull — Advanced Git Internals & Distributed Workflows