Skip to content

Commit ea296d4

Browse files
brabojclaude
andcommitted
docs: clarify direct push scenario in bare repo recipe
Make explicit that Bob pushes directly to Alice's machine (not via a server), so no fetch is needed — the push writes straight into her .git/ directory. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d91bc08 commit ea296d4

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

chapters/recipes/bare-repositories.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,20 @@ To understand why, remember that a push only updates the branch
121121
reference inside `.git/` — it does **not** touch the working tree.
122122
These are two separate operations, and only the first one happens.
123123

124-
Imagine Alice and Bob, where Alice's repository is non-bare and Bob
125-
tries to push to it:
126-
127-
1. Alice clones a repository and checks out `main`. Her working tree
128-
has the files from commit `A`.
124+
Imagine Alice and Bob working on the same local network. Bob has
125+
Alice's repository configured as a remote (pointing directly at her
126+
machine, not at a server like GitHub). This means Bob can push
127+
commits straight into Alice's `.git/` directory — no fetch required
128+
on Alice's side.
129+
130+
1. Alice checks out `main`. Her working tree has the files from
131+
commit `A`.
129132
2. Alice edits `report.txt` but has not committed yet.
130-
3. Bob pushes a new commit `B` to Alice's repository. The push
131-
updates the reference `.git/refs/heads/main` to point to `B`
132-
but Alice's working tree is not updated. Her files on disk are
133-
still from commit `A`, plus her uncommitted edits.
133+
3. Bob runs `git push alice-machine main`, which writes his new
134+
commit `B` directly into Alice's `.git/` and updates her
135+
reference `.git/refs/heads/main` to point to `B` — but Alice's
136+
working tree is not updated. Her files on disk are still from
137+
commit `A`, plus her uncommitted edits.
134138
4. Alice's repository is now in a broken state:
135139
- `HEAD``main` → commit `B` (moved by the push)
136140
- Working tree → files from commit `A` + uncommitted edits (untouched)

0 commit comments

Comments
 (0)