How git pull Works (Fetch + Merge)

git pull downloads new commits from a remote branch and immediately merges them into your current local branch.

Published September 27, 2026

git pull is a shortcut for git fetch followed by git merge (or rebase): it downloads new commits from the remote and integrates them into your current branch.

How it works

Fetch only updates your view of the remote (origin/main). The merge step then combines origin/main into your local branch, which can create conflicts.

Set pull.rebase true to replay your commits on top instead of creating a merge commit.

Try it

git pull
Updating a1b2c3..d4e5f6 Fast-forward
git pull --rebase
Successfully rebased and updated refs/heads/main.

Practical examples

Plain pull

git pull

Pull with rebase

git pull --rebase

Make rebase the default

git config --global pull.rebase true

Fast-forward only

git pull --ff-only

Common mistakes

  • Pulling with uncommitted changes and causing conflicts.
  • Unwanted merge commits on every pull.
  • Pulling the wrong branch.

Key takeaways

  • pull = fetch + merge/rebase.
  • Use --rebase for linear history.
  • Commit or stash first.

FAQ

Is pull dangerous?

Not dangerous, but it can create conflicts you must resolve.

What does ff-only do?

Refuses to merge unless it can fast-forward.

More Git articles