git pull

Download changes from the server and merge them into the current branch

What it does

git pull is git fetch and git merge in one command: it downloads the new commits for the current branch and merges them in. If you have no commits of your own, the branch simply catches up with the server.

If both you and the server have new commits, the branches have diverged: git makes a merge commit or asks you to pick a way, --no-rebase (merge) or --rebase (your commits move on top of the downloaded ones and history stays straight). The pull.rebase setting remembers the choice. Commit your edits or put them aside with git stash before pulling.

Syntax

git pull
git pull --rebase
git pull <remote> <branch>

Examples

Related commands

Practise · All commands