Skip to content

Fetch

In one line

Fetching downloads commits and updates from a remote without merging them into your working branch — it is a safe, read-only sync.

In simple words

git fetch downloads new commits, branches, and tags from a remote repository but does NOT modify your working directory or local branches. It only updates your remote-tracking branches (like origin/main).

Think of fetch as "check what is new on the server." After fetching, you can inspect the remote changes with git log origin/main or git diff main origin/main before deciding to merge them. This makes fetch safer than pull — you stay in control.

git pull is actually git fetch followed by git merge. If you want to see what changed before integrating it, use fetch first. Many developers fetch at the start of each work session to stay aware of remote changes.

Example

bash
# Download remote changes without merging
git fetch origin

# See what is new on the remote
git log main..origin/main

# Then merge when ready
git merge origin/main

fetch downloads but does not merge. You inspect and merge manually.

Common confusions

  • Confused with: pull

    The difference: fetch only downloads remote data; pull downloads AND merges into your current branch. Fetch is safe (no file changes); pull modifies your files.

Related terms

Related Resources

Related Lessons

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary