git fetch
git fetch downloads new commits and branches from a remote without changing your working files. It updates your local view of the remote so you can inspect changes before merging them.
Git & DevOps
Unlike git pull, fetch is non-destructive: it never touches your current branch or your files. The new history is stored under remote-tracking branches like origin/main.
Fetching first, then reviewing with git log or git diff, gives you control over what gets merged and when.
Syntax
git fetch <remote>Examples
Bash
git fetch originOutput:
remote: Enumerating objects: 8, done.
From https://github.com/you/repo
4b8c7d2..a1c9e0f main -> origin/main