origin/main is a bookmark: where main was on GitHub the last time you looked. It only moves when you talk to GitHub. git fetch downloads every new commit and moves the origin/… bookmarks. Your own branches and files stay exactly as they are.
git fetch
From https://github.com/monster-market/blog.git
af906b0..2e7b3fa main -> origin/main ← the bookmark moved
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 cleanBehind means origin/main has commits your main doesn't. Fetching first lets you look at a teammate's work before you take it. origin/main works anywhere a branch name does:
git show origin/main
commit 2e7b3fa1bfb696a9ad7cbccc09f0732386f80c6a
Author: Sam <[email protected]>
Date: Sat Mar 15 12:24:00 2025 +0000
Write the second post
diff --git a/post.md b/post.md
index 906184e..aa12820 100644
--- a/post.md
+++ b/post.md
@@ -1 +1,2 @@
First post
+Second postObjectives
- Fetch Sam's work.
- Count how far behind you are.
- Look at Sam's change before taking it.