🎓 A1Learner
🔍
0 of 50 lessons completed

Fetch Before You Pull

Fetch downloads new work without joining it. It lets you look before you join.

Download without joining

Git prints where the work came from. The folder path looks long because the practice remote sits next to the project.

$ git fetch origin

See how far behind you are

Status counts the missing snapshots.

$ git status

List the missing snapshots

The range reads as: from your newest snapshot to the remote’s newest one.

$ git log HEAD..origin/main --oneline

Example

$ git fetch origin
$ git status

Key points

  • Fetch only downloads. Your files do not change.
  • Status then tells you how far behind you are.
  • The range command lists the snapshots you have not got yet.
  • Fetch is safe to run any time. It changes nothing.
  • Pull is fetch plus a join. Fetch alone is the careful half.
  • Use fetch when you want to read the new work first.

Here, fetch downloads one snapshot. The files stay as they were. Status says the branch is one commit behind.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

What changes when you fetch?