Pull & Fetch
Get updates from the remote into your local repo
Skills taught: git.pull, git.fetch
git fetch — safe download
# Download updates without changing your files
git fetch origin
# See what's new on the remote
git log origin/main --oneline
# or
git log HEAD..origin/main --oneline # commits on remote but not local
# After inspecting, merge manually
git merge origin/main
# Fetch all remotes
git fetch --all
# Fetch and prune deleted remote branches
git fetch --prune
git pull — fetch + merge
# Standard pull (fetch + merge)
git pull
# Pull from specific remote and branch
git pull origin main
# Pull with rebase instead of merge (cleaner history)
git pull --rebase
# Set rebase as default pull behaviour
git config --global pull.rebase true
# Start of day workflow
git switch main
git pull
git switch feature/my-task
git rebase main # bring in the latest main into your feature branch
Frequently Asked Questions
Should I use git pull or git fetch + git merge?
Both are fine. git pull is simpler for daily use. git fetch + inspect + merge gives you more control — you can see what changed before integrating. Use git pull --rebase to get a cleaner linear history.
git pull failed with 'Not possible to fast-forward'. What now?
Both your local branch and the remote have new commits. Either merge: git pull (creates a merge commit), or rebase: git pull --rebase (replays your commits on top). If you see many of these, consider making git pull always rebase: git config --global pull.rebase true.