APM

>Agent Skill

@lajarre/worktree-tending

skillgit-workflow

Use when creating, switching, merging, or removing git worktrees. Use when user mentions worktrees, branches in parallel, .tree/ directories, or submodule branch coordination.

git
apm::install
$apm install @lajarre/worktree-tending
apm::skill.md
---
name: worktree-tending
description: Use when creating, switching, merging, or removing git worktrees. Use when user mentions worktrees, branches in parallel, .tree/ directories, or submodule branch coordination.
---

# Worktree Tending

Manage git worktrees with **worktrunk** (`wt`). Run `wt --help` or `wt <cmd> --help` for full command reference.

## Critical Rule

**After ANY worktree operation, run `wt list` and show results before yielding to user.**

## Quick Reference

| Task | Command |
|------|---------|
| New branch + worktree | `wt switch --create <branch>` |
| Existing branch | `wt switch <branch>` |
| GitHub PR | `wt switch pr:123` |
| List all | `wt list` |
| Interactive picker | `wt select` |
| Merge to main | `wt merge` (from feature worktree) |
| Remove without merge | `wt remove` or `wt remove -D <branch>` |
| Archive branch | `git archivebranch <branch>` (no wt equivalent) |

## What wt --help Won't Tell You

**Root worktree convention:** Keep detached on `origin/main` to avoid conflicts. After merges: `git checkout --detach origin/main`

**wt merge direction:** Run from *feature* worktree, merges current → target (opposite of `git merge`)

**Config location:** `~/.config/worktrunk/config.toml` — sets `.tree/` path template, post-create hooks, and `squash = false` default

## Submodules

`wt` doesn't manage submodules. Helper scripts in `~/bin/`:

- `git substat` — status of all submodules (branch, dirty state)
- `git subdate [branch]` — update submodules to main or specific branch
- `git superbranch` — match submodule branch to parent (run inside submodule)