Remote vs Local: What Git Knows
Someone else commits somewhere else. See exactly what git fetch shows you — and what it deliberately leaves untouched.
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.\n\ngit 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.
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.
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.
👥 Simulate a Teammate's Real Commit
Clone the remote into a second location and commit there — a genuinely independent real commit, pushed straight to origin.
cd ~/recipes && git clone ../recipes-origin.git /tmp/teammate-clonecd /tmp/teammate-clone && git config user.name 'Grace Hopper'cd /tmp/teammate-clone && git config user.email 'grace@example.com'cd /tmp/teammate-clone && printf 'Banana Bread\n\nMash bananas, mix batter, bake at 175C for 50 minutes.\n' > banana-bread.mdcd /tmp/teammate-clone && git add banana-bread.mdcd /tmp/teammate-clone && git commit -m 'Add banana bread recipe'cd /tmp/teammate-clone && git pushstudent@lab:~$ cd ~/recipes && git clone ../recipes-origin.git /tmp/teammate-clone Cloning into '/tmp/teammate-clone'... done. student@lab:~$ cd /tmp/teammate-clone && git config user.name 'Grace Hopper' student@lab:~$ cd /tmp/teammate-clone && git config user.email 'grace@example.com' student@lab:~$ cd /tmp/teammate-clone && printf 'Banana Bread\n\nMash bananas, mix batter, bake at 175C for 50 minutes.\n' > banana-bread.md student@lab:~$ cd /tmp/teammate-clone && git add banana-bread.md student@lab:~$ cd /tmp/teammate-clone && git commit -m 'Add banana bread recipe' [master 155564e] Add banana bread recipe 1 file changed, 3 insertions(+) create mode 100644 banana-bread.md student@lab:~$ cd /tmp/teammate-clone && git push Enumerating objects: 4, done. Counting objects: 100% (4/4), done. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 339 bytes | 37.00 KiB/s, done. Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 To /home/student/recipes/../recipes-origin.git dfca8a1..155564e master -> master
☕ Commit Locally, Without Pushing
Back in your own clone, make a real commit of your own — genuinely unaware of the teammate's.
cd ~/recipes && printf 'Iced Coffee\n\nBrew coffee, cool, pour over ice.\n' > iced-coffee.mdcd ~/recipes && git add iced-coffee.mdcd ~/recipes && git commit -m 'Add iced coffee recipe'student@lab:~$ cd ~/recipes && printf 'Iced Coffee\n\nBrew coffee, cool, pour over ice.\n' > iced-coffee.md student@lab:~$ cd ~/recipes && git add iced-coffee.md student@lab:~$ cd ~/recipes && git commit -m 'Add iced coffee recipe' [master b0451ae] Add iced coffee recipe 1 file changed, 3 insertions(+) create mode 100644 iced-coffee.md
📡 Fetch — Look, Without Touching Anything
Download what changed on the remote and see exactly what fetch does and does not update.
cd ~/recipes && git fetch origincd ~/recipes && git log --oneline origin/master -3cd ~/recipes && git log --oneline master -3cd ~/recipes && ls banana-bread.mdstudent@lab:~$ cd ~/recipes && git fetch origin remote: Enumerating objects: 4, done. remote: Counting objects: 100% (4/4), done. remote: Compressing objects: 100% (3/3), done. remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), 319 bytes | 39.00 KiB/s, done. From ../recipes-origin dfca8a1..155564e master -> origin/master student@lab:~$ cd ~/recipes && git log --oneline origin/master -3 155564e (origin/master) Add banana bread recipe dfca8a1 Stop tracking db-credentials.txt bd7db64 Add database credentials student@lab:~$ cd ~/recipes && git log --oneline master -3 b0451ae (HEAD -> master) Add iced coffee recipe dfca8a1 Stop tracking db-credentials.txt bd7db64 Add database credentials student@lab:~$ cd ~/recipes && ls banana-bread.md ls: banana-bread.md: No such file or directory
🔗 Merge to Genuinely Combine Both
Now bring the fetched commit into your own history, combining both real, independent changes.
cd ~/recipes && git merge origin/master --no-editcd ~/recipes && git log --oneline --graph -5cd ~/recipes && ls banana-bread.md iced-coffee.mdstudent@lab:~$ cd ~/recipes && git merge origin/master --no-edit Merge made by the 'ort' strategy. banana-bread.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 banana-bread.md student@lab:~$ cd ~/recipes && git log --oneline --graph -5 * 254e8b2 (HEAD -> master) Merge remote-tracking branch 'origin/master' |\ | * 155564e (origin/master) Add banana bread recipe * | b0451ae Add iced coffee recipe |/ * dfca8a1 Stop tracking db-credentials.txt * bd7db64 Add database credentials student@lab:~$ cd ~/recipes && ls banana-bread.md iced-coffee.md banana-bread.md iced-coffee.md
Lab 1.5.4 complete — Certificate 1 complete. Two real, independent commits, safely inspected, then genuinely combined:\n\n\n Teammate's real commit made : ✅ separate clone, pushed\n Local commit made, unpushed : ✅ genuinely independent\n Fetch: looked, untouched : ✅ confirmed via ls + log\n Merge: genuinely combined : ✅ real merge commit\n
Enable JavaScript to run the live terminal and track your progress.