Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

docs: clarify worktree terminology (main, linked, primary) (#788)

Maximilian Roosff2f977ad992
diff --git a/CLAUDE.md b/CLAUDE.md
index 61251b0f8..d100743a1 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -31,7 +31,9 @@ Use deprecation warnings to get there smoothly when external interfaces must cha
Use consistent terminology in documentation, help text, and code comments:
-- **main worktree** — the primary worktree (the original git directory), not "main branch worktree"
+- **main worktree** — the original git directory (from clone/init); bare repos have none
+- **linked worktree** — worktree created via `git worktree add` (git's official term)
+- **primary worktree** — the "home" worktree: main worktree for normal repos, default branch worktree for bare repos
- **default branch** — the branch (main, master, etc.), not "main branch"
- **target** — the destination for merge/rebase/push (e.g., "merge target"). Don't use "target" to mean worktrees — say "worktree" or "worktrees"
diff --git a/src/git/repository/worktrees.rs b/src/git/repository/worktrees.rs
index 5e736bd59..d4d635ca3 100644
--- a/src/git/repository/worktrees.rs
+++ b/src/git/repository/worktrees.rs
@@ -55,14 +55,10 @@ impl Repository {
.map(|wt| wt.path.clone()))
}
- /// The primary worktree — where established files (ignored files, configs) typically live.
- ///
- /// - Normal repos: the main worktree (repo root) — this is where you cloned and set things up
- /// - Bare repos: the default branch's worktree — no main worktree exists
+ /// The "home" worktree — main worktree for normal repos, default branch worktree for bare.
///
+ /// Used as the default source for `copy-ignored` and the `{{ primary_worktree_path }}` template.
/// Returns `None` for bare repos when no worktree has the default branch.
- ///
- /// For template var `{{ primary_worktree_path }}`.
pub fn primary_worktree(&self) -> anyhow::Result<Option<PathBuf>> {
if self.is_bare() {
let Some(branch) = self.default_branch() else {