What is the difference between 'git pull' and 'git fetch'?
Published
27 Dec 2022
TLDR;
git fetch is similar to pull but doesn't automatically merge; it fetches remote updates, but your local stays the same.
git pull pulls down from a remote and instantly merges with your local.
Fundamentals
If you're new to Git, you're probably confused by the difference between git pull and git fetch. They seem to do similar things but aren't exactly the same.
Git is a distributed version control system. Your local repository is identical to any other remote Git repository, including those found on GitHub and your coworker's machine.
Remote repositories are referenced in your local repository as remote tracking-branches that are linked to there upstream remotes source. To make sure they accurately represent the state of the remote repository, you are not able to modify (move) them directly, Git will do this for you.
To apply changes from a remote repository to your own local working copy, you need first to update your local remote-tracking branch and then apply the changes to your local working branch. To do this, you need to use the git merge, or the git rebase command.
This is particularly important as changes from a remote may break your local working branch, and my need to be applied with your input.
git fetch
git fetch brings your local remote-tracking branches up-to-date with its remote version.
The git fetch operation is safe to run at any time since it never changes any of your local working branches. You will need to use git merge or git rebase to do this.
git pull
git pull brings a local remote-tracking branch up-to-date with its remote version while also attempting to automatically update your own local working branch.
git pull automatically merges the commits without letting you review them first. You may run into frequent conflicts and issues if you are not careful.
Why shouldn't you use git pull?
git pull isn't bad if used properly. The pull command combines two commands, git fetch and git merge. This is safe if your local branch is in sync with the remote branch. If it's not, git pull can modify your local working branch in unpredictable ways and introduces unnecessary nonlinearities in the history.
It's generally preferred to use git fetch followed by git rebase. Git fetch beings down the local changes without applying them to your working branch and git rebase re-writes the history by creating brand new commits for each commit in the local working branch and allows you to apply changes safely.
Similar articles

Sorting Algorithms Explained
Bubble, selection, insertion, merge, quick, and heap sort: how each one works, where it shines, where it struggles, and animated demos that run the real algorithm code on the same starting data every time.
13 July 2026

Set Membership Testing: From Arrays to Bloom Filters
Every time Chrome warns you a site might be malicious, it just answered a membership question: is this URL in a set of bad ones? Here's how that check works, from a plain array to the probabilistic Bloom filter that makes it possible at scale.
10 July 2026

Why You Shouldn't Use Floating Point Math for Money in JavaScript
JavaScript numbers look like ordinary decimals, but they are stored as binary floating point. That is why 0.1 + 0.2 is not 0.3, and why checkout totals, tax lines, and ledger comparisons can quietly go wrong.
4 July 2026

RFC 10008: HTTP Finally Gets a Query Method
For thirty years, complex searches have been squeezed into GET query strings or smuggled through POST. RFC 10008 standardises QUERY: a safe, idempotent HTTP method with a request body. Here is why that matters and when you can actually use it.
3 July 2026
