What is the difference between git pull and git fetch?
⚡
Quick Answer
git fetch downloads new commits/refs from the remote but leaves your working branch untouched. git pull runs a fetch and then merges (or rebases) those changes into your current branch.
Detailed Answer
Fetch is the safe, inspect-first option — it updates remote-tracking branches so you can review before integrating. Pull = fetch + merge (or fetch --rebase for a linear history). Teams that value clean history often use pull --rebase or fetch-then-review rather than a plain pull that creates merge commits.
💡
Interview Tip
pull = fetch + merge; recommend fetch-then-review or pull --rebase for a cleaner history.
gitpullfetch