Git fetch downloads updates from a remote repository into your local Git data, but it does not merge them into your current branch. That makes it a safe way to see what changed before you decide to integrate it.

What it does

  • Retrieves new commits, branches, and tags from a remote like origin.
  • Updates your remote-tracking branches such as origin/main.
  • Leaves your working files and current branch unchanged.

Why it matters

git fetch is useful when you want to review remote changes first, compare history, or avoid accidental merges. Git documentation describes it as downloading refs and the objects needed to complete their histories, which is why it does not rewrite your local work.

Fetch vs pull

  • git fetch: downloads remote updates only.
  • git pull: downloads and then merges, or rebases depending on your setup.

A simple example: if a teammate pushes new work to main, git fetch lets you inspect origin/main before deciding whether to merge it into your branch.

Useful commands

  • git fetch
  • git fetch origin
  • git fetch --all
  • git fetch --tags

TL;DR: git fetch updates your local view of the remote without changing your current branch, so you can review changes safely first.