From b018aa52d2e7d08838d658ff74a0c2a4115acf1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Tue, 25 Aug 2026 20:13:28 +0000 Subject: [PATCH] cloning into the folder you are already in, and what it destroys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `git clone .` works only into a genuinely empty directory. verified: one file makes it fail, and so does one HIDDEN file. which is not an edge case on this machine — a commander's directory holds CLAUDE.md and state/, and a plugin's chat directory holds a CLAUDE.md the platform wrote. cloning into either fails outright. the fetch-into-place workaround is written down because it is the answer, and so is the thing it does quietly: `git checkout FETCH_HEAD -- .` OVERWRITES a colliding file without asking. verified by doing it in a directory that had a CLAUDE.md and watching it become the template's. in a commander directory that is the brief gone, and the commander would come back next turn not knowing what its job is. Co-Authored-By: Claude Opus 5 Officer-Session: 656f5c85-e49a-4f1f-b9f3-042a04b4d043 --- affordances/officer/core/starting-an-app.md | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/affordances/officer/core/starting-an-app.md b/affordances/officer/core/starting-an-app.md index 9f8403c..e550384 100644 --- a/affordances/officer/core/starting-an-app.md +++ b/affordances/officer/core/starting-an-app.md @@ -19,6 +19,33 @@ shell; the SSH remote is already authenticated. If SSH is being refused for a st behind a proxy that rate-limits it — `ssh://git@100.64.0.13:10023/templates/template-react.git` is the same repository over the tailnet. +### Cloning into the folder you are already in + +`git clone .` works, **and only into a genuinely empty directory**. Verified: a single file makes it +fail, and so does a single HIDDEN one — + +``` +fatal: destination path '.' already exists and is not an empty directory. +``` + +That is not an edge case here. A commander's directory holds `CLAUDE.md` and `state/`; a plugin's chat +directory holds a `CLAUDE.md` the platform wrote. Cloning into either fails. + +When the directory is not empty, fetch instead of cloning: + +```bash +git init -q . +git remote add origin git@gitea.officer.dev:templates/template-react.git +git fetch -q --depth 1 origin HEAD +git checkout -q FETCH_HEAD -- . +git reset -q +``` + +**This overwrites a file that collides, without asking.** Also verified: doing it in a directory that +already had a `CLAUDE.md` replaced it with the template's. So look at what is there first, and if one of +those files is the platform's — a commander's brief, a plugin's chat brief — move it aside and put it back, +or clone somewhere else and copy in what you need. + ## Then read its own documentation, and do step 1 The template documents itself. **`README.md` step 1 is a rename** — everything project-specific is called