A Real Commit, Made Somewhere Else
git clone ../recipes-origin.git /tmp/teammate-clone
# ...edit and commit there...
git push
A genuine second, independent clone — standing in for a teammate's machine, or GitHub's own web editor, which commits through exactly this same real mechanism.
A Genuinely Independent Local Commit
# back in ~/recipes, never pushed yet
git commit -m "Add iced coffee recipe"
Two real commits now exist, on two different real machines (or clones), each unaware of the other.
Fetch: Look, Don't Touch
git fetch origin
git log --oneline origin/master -3
git log --oneline master -3
origin/master genuinely moved to include the teammate's commit. master — and every actual file in the working directory — is completely untouched. This is real, deliberate safety: you get to look before anything changes.
Merge: Now Combine Them
git merge origin/master --no-edit
A real merge commit, with two real parents — your local commit and the fetched one — genuinely combining both histories into one.
A second, real clone of the remote stands in for a teammate — or you, using GitHub's own web editor, which works by committing directly to the remote. While that commit happens somewhere else, you make a genuinely independent commit locally, without pushing.
git fetch is the real, careful first step: it downloads what changed on the remote and updates origin/master to match — and genuinely nothing else. Your working directory, your local master, your actual files: all completely untouched until you explicitly decide to merge. This lesson makes that real separation visible, not just described.
git fetch
Downloads new commits and updates remote-tracking references (like origin/master) to match the remote — genuinely nothing else. Confirmed directly in this lab: after fetching, the teammate's new file did not exist in the working directory at all, even though origin/master already pointed past it.
git merge origin/master
Combines the current branch's history with a specified reference — here, the just-fetched origin/master. Confirmed directly in this lab producing a real merge commit with two parents, and both the local and remote files finally appearing together.
Takeaways
- git fetch updates remote-tracking references (origin/master) only — the working directory and local branches are genuinely untouched
- A remote-tracking branch is a real, local record of the remote's state as of the last fetch — not a live view
- git merge is the real, separate step that actually combines fetched history into your own branch
- git pull is genuinely fetch + merge in one command — running them apart reveals the inspection window pull skips
- This entire lesson's remote was a real, local bare repository — every command here works identically against a genuine GitHub remote