Interview Q&A / Git & GitHub

BeginnerQuick answer1 min readUpdated 3 Oct 2026

What is the difference between git fetch and git pull?

SHORT ANSWER

git fetch downloads new commits from the remote and updates your origin/* references without touching your own branch. git pull does a fetch and then merges (or rebases) the result into your current branch.

Explain it simply

Fetch is checking the notice board; pull is checking it and then copying every notice into your own diary.

After git fetch, your local main is unchanged, but origin/main shows what the server has. You can inspect with git log main..origin/main and decide what to do. git pull is shorthand for git fetch followed by git merge origin/main, so it immediately changes your branch and may create conflicts. Fetching first is the careful habit.

Example

bash
git fetch origin
git log --oneline main..origin/main   # what's new on the server
git merge origin/main                 # now integrate
# equivalent in one step:
git pull origin main

What to say in the interview

"fetch only downloads remote changes and updates remote-tracking branches, so it is safe. pull is fetch plus merge or rebase into my current branch. I often fetch first to review incoming commits before integrating."

#git#fetch#pull

Related questions

Practise more Git & GitHub questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Git & GitHub quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.