Skip to content

Pull

In one line

Pulling downloads commits from a remote repository and merges them into your current local branch.

In simple words

git pull brings remote changes into your local branch. It is the inverse of git push — push sends your commits up, pull brings others' commits down. Pull keeps your local copy up to date with what your collaborators have published.

Under the hood, git pull is two operations in sequence: git fetch (download the remote commits without changing your files) followed by git merge (integrate those commits into your current branch). If the merge hits conflicts, you resolve them just like any other merge.

Before pushing, you often pull first to make sure you have the latest remote changes. This avoids push rejections and keeps the history clean. In active teams, pulling at the start of each work session is a good habit.

Example

bash
# Pull the latest changes from origin/main
git pull origin main

# If tracking is set up, just:
git pull

# pull = fetch + merge, so this is equivalent:
git fetch origin
git merge origin/main

git pull fetches remote commits and merges them into your current branch. It is fetch + merge.

Common confusions

  • Confused with: fetch

    The difference: git fetch downloads remote commits but does not modify your working files; git pull fetches AND merges those commits into your current branch. Pull changes your files; fetch only updates your remote-tracking refs.

Related terms

Related Resources

Related Lessons

Learn the fundamentals

Deepen your understanding with structured lessons on this topic.

View lessons

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary