Git Fetch
git fetch downloads new commits and branches from a remote. It updates the remote-tracking branches, like origin/main, but does not touch your own branches or files.
This lets you look at what changed before you merge it. git pull is a fetch followed by a merge.
Fetch from origin
git fetch origin
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
From https://github.com/w3schools-test/hello-world
d994bf3..87cd5ca main -> origin/main
git status
On branch main
Your branch is behind 'origin/main' by 1 commit, and can be fast-forwarded.
(use "git pull" to update your local branch)
nothing to commit, working tree clean
See what you fetched
List the commits on origin/main that are not on your main yet:
git log --oneline main..origin/main
87cd5ca Updated README.md with a line about the repository