git fetch
downloads the commits from the remote repository so they are included in your local repo, but it doesn't change your local branch.
e.g., if you are working on the main branch, if you do a git fetch
from GitHub then your teammates' code will get fetched into your repo, but your files in your working directory won't change, and your HEAD and main will still point to the same place they did before you fetch
ed.
If you do a git pull
, then git performs a git fetch
first, and THEN a git merge
that attempts to merge the remote changes with yours. (It may do a fast-forward merge if you haven't made any changes.)