git fetch

git fetch downloads new objects and updates remote-tracking references without changing your current working branch. It is useful when you want to inspect incoming changes before integrating them.

Fetch and Inspect
git fetch origin
git log main..origin/main --oneline
git diff main origin/main
💡 Fetching updates origin/main. You can then inspect commits and differences before deciding whether to merge or rebase.
Key Takeaways
  • git fetch does not normally modify your working branch.
  • It updates remote-tracking references such as origin/main.
  • Fetching before integration gives you control over how incoming changes are handled.
Knowledge Check

What is a key property of `git fetch`?