Fetching obtains available commits and updates local remote-tracking references. With a configured remote called origin:
git fetch origin
git branch -a
git log --oneline main..origin/main
git log --oneline origin/main..main
These comparisons assume both names exist. The first log lists commits reachable from the last-fetched origin/main but not local main; the second lists commits reachable from local main but not origin/main. Either list can be empty. git log --oneline --graph --decorate --all helps show their common ancestry.
origin/main is a local record of the remote’s main as last fetched, not a live connection. Another person may push immediately afterward. Fetch transfers relevant objects as well as reference updates, but does not merge into your current branch or change your working files. Permissions and fetch configuration can limit which references are available.