Skip to content

Adopting what you have

This is the part that matters on a machine you have been using for years.

talea never clones a repo you already have. Before cloning anything it scans the workspace — and any folder you name with --from — and matches every checkout it finds by its git remote, not by folder name. A repo cloned into ~/tmp/clone2/whatever is recognised as the repo it holds and moved into place.

Terminal window
talea adopt # show what would move, change nothing
talea adopt --from ~/Desktop # look there too; the folder is remembered
talea adopt --apply # do it

The default is a dry run. Always read it before applying — a move relocates directories you may have open in an editor, a terminal or a long-running process.

Why a move and not a re-clone

A rename keeps branches, stashes, the reflog and your uncommitted changes, because none of them ever leave the directory. It is also instant. A re-clone silently discards all of it.

talea also never copies-then-deletes. A cross-device move is refused and reported, not turned into a copy and a delete.

Exact matches and name-only matches

matchRepo returns one of two answers:

MatchWhat happens
exact — the remote URL matchesMoved by clone, sync and adopt --apply
name — only the repo name matchesListed, and left alone

--loose, or naming the repo with -r, is how you include a name-only match once you have looked at it.

Worktrees travel with their repo

A worktree’s link to its repo is an absolute path, so renaming the repo breaks every worktree at once.

talea reads the worktree list before the rename — afterwards every worktree that moved is reported prunable, indistinguishable from a dead one — then moves the sibling <repo>-worktrees/ folder alongside the repo and runs git worktree repair with the new paths. Worktrees that did not move are repaired where they sit.

A repair is checked, not assumed: afterwards each worktree must resolve to the moved repo. One that does not is reported with git’s own reason and the git worktree repair command to run once that reason is dealt with, and the run exits non-zero — adopt, clone, sync and add alike, and the summary counts it as a failure. git rewrites every worktree’s link on any repair, so one worktree it cannot write — read-only, on a drive that is not mounted — fails them all, and the reason names that one. Run the printed command in a shell with no GIT_DIR set. If git says it cannot locate the repository, the worktree’s record is gone: its files are all there, so keep what you need and make it again with git worktree add. The repo stays where it moved — moving it back could fail the same way — and the worktree’s files are untouched; only its link is stale. If git cannot even list a repo’s worktrees, the repo is not moved, because “no worktrees” is the answer that would strand them all.

Every git call here runs with git’s repository-scoping variables cleared (GIT_DIR, GIT_WORK_TREE and the rest). A talea run started from a git hook inherits them, and they would otherwise point every call at the hook’s repository.

While a move runs

Nothing else may change a repo or its worktrees while talea moves it. Close editors, terminals, agents and long-running builds that sit in the checkout first. On Windows the move is refused while any process holds a file open in it; elsewhere it succeeds, and a process still inside keeps writing to paths that no longer lead to the repo. A brief hold on Windows — the virus scanner or search indexer, just after talea read the repo — is waited out for up to five seconds, stopping git’s fsmonitor daemon once; a terminal whose current folder is inside the repo is named as the cause, because no wait outlasts it. A worktree created by another process during the move is not in the list read before it, and is not re-linked.

A linked worktree is never treated as a second copy of the repo, even though git reports the same origin for both. Renaming one would unroot its commits.

Duplicates are parked, not deleted

If the same repo turns up twice, the copy at the catalogue path wins and the other moves into .talea-duplicates/<GROUP>/<repo> with everything in it — branches, stashes, uncommitted work — and is listed so you can decide what to do with it.

There is no recursive delete anywhere in the code that moves things. Clearing that folder is your decision.

What cannot be moved

A repo that cannot be moved safely is left alone and the reason is printed:

  • it is itself a linked worktree
  • the destination is already occupied — checked again just before the move, so a folder that filled up since the plan is named as the cause rather than reported as a lock
  • the move would cross a filesystem

An empty folder at the destination does not count as occupied. It is removed first — with the call that refuses a folder holding anything — because Windows will not rename onto an existing folder.

A checkout git refuses to open — on Windows usually dubious ownership: cloned from an admin shell, another account or WSL — has no remote to match on, so it is never moved. It is named with git’s own reason and, for ownership, the command to run if it really is yours:

Terminal window
git config --global --add safe.directory 'C:/src/the-folder'

and the run exits non-zero. clone and sync clone nothing for a repo whose folder name it shares, so no second copy lands beside it. A repo with no origin at all is local-only, not refused, and is left out quietly.

A linked worktree whose repo no longer knows it — left behind after the repo pruned its record, or after the repo was moved by hand — is not a refusal either. It is named as one, with the fix:

Terminal window
# its branch is still in the repo: save what you need from the folder, delete it, then in the repo
git worktree add '/path/to/app-worktrees/feat-x' <branch>
# if the repo was moved by hand instead, run in it
git worktree repair '/path/to/app-worktrees/feat-x'

git worktree repair cannot bring back a record the repo deleted — it fails with “unable to locate repository” — which is why the first fix makes the worktree again instead. It is a warning only: the run does not fail over it, and it holds nothing back from cloning. One sitting where a catalogue repo belongs is not fetched by sync; that repo counts as skipped until the folder is dealt with.

Paths are repaired afterwards

A repo that moves and loses its history has not really been helped. After a move, absolute paths that pointed at the old location are updated: Claude Code session history and memory, its per-project settings, and config files in the workspace and the repo — .idea, .vscode, .claude, CLAUDE.md.

Terminal window
talea adopt --fix-paths # re-run just that repair, moving nothing

When another tool owns a checkout

Mark it in the catalogue and talea leaves it completely alone — not sync, not adopt, not exec --all, not talea add, not even an explicit -r:

{ "name": "some-repo", "owner": "someone", "ignore": true }

Without it, two tools that both organise repositories will each drag the same checkout back to where it thinks it belongs, on every run, forever. Use it for repos inside another workspace manager’s tree, vendored checkouts and SDK caches.


Next: For your agent.