git pull Fetch from a remote and update your branch

Downloads new commits for the branch you are on and combines them into it. It is git fetch followed by git merge, or by git rebase if you ask for that.

Synopsis

git pull [OPTION]... [REMOTE [BRANCH]]

Common options

Option or formWhat it does
--rebaseReplay your local commits on top instead of making a merge commit
--ff-onlyOnly update if it can be a clean fast-forward
--no-rebaseMerge, even if your settings say rebase
-p, --pruneAlso prune deleted remote branches
--autostashStash local changes first and reapply them after

Examples

Update the current branch
git pull
Updating 8b1d7e4..3f2a9c1
Fast-forward
 app.js | 4 ++--
Keep history in a straight line
git pull --rebase
Refuse anything but a simple update
git pull --ff-only
Pull a branch from a named remote
git pull upstream main
Make rebase the default
git config --global pull.rebase true

Notes

See also

Last reviewed 2026-10-09.