git pull

git pull downloads commits from a remote repository and merges them into your current branch in one step. It keeps your local copy up to date with changes others have pushed.

Git & DevOps

Under the hood, git pull is a git fetch (download) followed by a git merge (combine). If others changed the same lines you did, a pull can trigger a merge conflict.

It is good practice to pull before you start working and before you push, so you build on the latest version.

Syntax

git pull origin <branch>

Examples

Bash

git pull origin main

Output:

Updating 4b8c7d2..a1c9e0f
Fast-forward
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Learn it in a lesson

See also

Back to the Dictionary