git fetch
intermediateDownload the remote's objects — without merging, without touching your work.
git fetchWhat it does
git fetch connects to a remote, downloads whatever objects it has that you don't, and updates your remote-tracking refs (refs/remotes/origin/*). Your working tree, your index, your own branches — all untouched. Pull's harmless, half-remembered cousin; the one that never surprises you.
Your machine
local repository
Remote origin
everything.git
Only new objects travel down; your branch and worktree stay put
Watch it — press play
A narrated, step-by-step walkthrough that shows how to do it — not just theory. It adapts to the learner mode you picked in the top bar.
Step 1
See without changing
You want to peek at the remote's new commits without disturbing anything you're doing.
git fetchYour machine
local repository
Remote origin
everything.git
Objects download; your branch and files stay put
Under the hood
Object negotiation first
Fetch tells the remote which objects it already has ('want/dontwant'), so only the missing ones stream down — usually packed into one packfile, delta-compressed.
Refs update, branches don't
After objects land, fetch moves refs/remotes/origin/main forward (non-fast-forward refs are rejected as 'forced update' unless configured). Your local main still points at your own commits. Observe: nothing you're stood on moves.
The quiet inspection
`git fetch && git diff origin/main` is the 'show me what's coming WITHOUT changing anything' pattern — peer-reviewed-by-nobody-proof you can always see the future before you commit to it.
Command anatomy
--allFetch from every configured remote at once.
--pruneDelete local refs whose remote counterparts vanished.
<remote> <refspec>Fetch specific branches only.
When to reach for it
Just looking: see origin/main's new commits before you rebase onto them.
Syncing remote-tracking info when you're on a worktree you must not disturb.
Multi-remote projects: fetch upstream to keep the fork current.
Practice
A real repo, pre-seeded with history, runs right here — stage, commit, branch, stash, diff, even hit and resolve a real merge conflict. Nothing to install, nothing leaves your machine.
Open practice playground