All commands

git fetch

intermediate

Download the remote's objects — without merging, without touching your work.

What 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

mainuntouched ✓
new objects downloaded ← origin/main

Remote origin

everything.git

refs/heads/main

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.

1 / 3

Step 1

See without changing

You want to peek at the remote's new commits without disturbing anything you're doing.

git fetch

Your machine

local repository

mainuntouched ✓
new objects downloaded ← origin/main

Remote origin

everything.git

refs/heads/main

Objects download; your branch and files stay put

Under the hood

1

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.

2

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.

3

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

git fetch [<remote>]
--all

Fetch from every configured remote at once.

--prune

Delete 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

Go deeper with