Question

What is the difference between git fetch and git pull?

Vault Verified
Curated Intelligence
Definitive Source
Answer

Fetching downloads new commits from the remote and updates your remote-tracking references. It changes nothing about your working tree or your local branches. After fetching you know what has happened elsewhere, and your own work is untouched.

Pulling is fetching followed immediately by integrating those commits into your current branch. By default that integration is a merge, which can create a merge commit and, if your local changes overlap, can stop halfway with conflicts to resolve.

The practical difference is control. Fetching first lets you look before you leap: you can see how far behind you are, review what changed, and decide whether to merge, rebase, or wait. Pulling makes that decision for you at the moment you run it, which is convenient right up until it is not.

This matters most when you have uncommitted work. A pull that needs to merge will refuse or conflict, sometimes leaving a partially resolved state that is confusing if you were not expecting an integration at all. Fetching is always safe regardless of what your working tree looks like.

Many people configure pulling to rebase rather than merge, which keeps history linear and avoids merge commits for routine updates. That is a reasonable default for a personal feature branch, but it rewrites your local commits, so the usual caution about anything already shared applies.

A useful habit is to fetch routinely, inspect the difference between your branch and its remote counterpart, and integrate deliberately. It costs one extra command and removes most of the surprises people associate with updating a repository.

Related Questions