What is the difference between git fetch and git pull?
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
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 mainWhat 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."