Warm-up · from “Cloning and remote repositories”
What is origin?
What is origin?
No notes: write what you remember, then check. Recalling before reading is what makes it stick.
The problem
A colleague pushed a change while you were working. You want to inspect it before modifying your own branch.
After this lesson you can
Distinguish download, integration and publication.
Observe divergence.
Choose a pull strategy deliberately.
Key terms
Full glossarySay what each term means, then open it to check.
Remote-tracking ref · new in this lesson
Local record of a remote branch state, updated by configured operations.
HEAD · from lesson 14
Current symbolic branch reference or detached commit identity.
Index · from lesson 9
Prepared path-to-object entries, plus metadata and conflict stages.
Ref · from lesson 3
Name identifying an object; branch refs usually identify commits.
Refspec · preview, covered in lesson 24
Source-to-destination mapping for references.
Visual mental model
- Server main
- local origin/mainfetch
- local mainintegrate
Build the mental model
Ordinary git fetch origin downloads missing objects and updates configured remote-tracking refs. It normally does not modify your checked-out branch, Index or working files, though custom refspecs can update other refs. git pull fetches and then integrates using a merge, rebase or fast-forward-only behavior depending on options and configuration. git push asks the remote to update refs using objects you supply.
A simplified model for building intuition. It does not read your sandbox; use the terminal for real behaviour.
Under the hood
A normal branch push rejects a non-fast-forward update, preventing accidental replacement of others' history. Fetch first, inspect git log --left-right HEAD...origin/main, and integrate according to team policy. git status can report ahead/behind when the branch has an appropriate upstream; it compares local refs, not live server state. git pull --ff-only is a conservative way to advance an undiverged branch.
Common mistake · important nuance
Fetch is not pull, and origin/main is only as current as your latest relevant communication.