git fetch retrieves changes from a remote repository without applying those files locally. Use it to discover remote updates before deciding whether to pull them. section 19.5
A practical remote-update workflow is:
- Run git fetch when a collaborator changes files in GitHub; git status alone does not reveal those remote changes. section 19.5
- Inspect the fetch result, then run git pull when changes need to be brought into the local repository. section 19.5
Checking for remote changes
From the local repository, git fetch reports updates such as main -> origin/main. Running git pull afterward applies the fast-forward changes and brings the local and remote repositories back into sync. section 19.5
PS C:\MyPSTool> git fetch remote: Counting objects: 6, done. remote: Compressing objects: 100% (5/5), done. remote: Total 6 (delta 2), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (6/6), done. From https://github.com/psjamesp/MyPSTool 737445d..01f65d7 main -> origin/main
See the command output that identifies newly fetched commits and updates the origin/main remote-tracking reference. section 19.5
