Setup and Cleanup
Choose the simplest tool that fits:
copyfor an independent file in each worktreesymlinkfor intentionally shared stateaw setupfor explicit setup- lifecycle hooks for automatic create or remove behavior
Avoid symlinking node_modules; branches can require different dependencies.
Add a setup hook
Section titled “Add a setup hook”A repository post-create hook runs in the new child worktree:
{ "repos": { "web": { "path": "repos/web", "hooks": { "post-create": "corepack pnpm install --frozen-lockfile" } } }}Keep short commands inline. Put substantial logic in one platform-native file.
Choose a scope
Section titled “Choose a scope”- Repository hooks belong to one child.
- Workspace hooks belong to the meta-repository.
- User-global hooks follow you across workspaces.
Keep hooks fail-fast and idempotent. Shared remove hooks may run once per target repository.
Test hooks
Section titled “Test hooks”- Activate one source for each hook location.
- Use
aw remove --dry-runto preview remove-hook discovery. - Create or remove a disposable branch and inspect the outcome.
Configured aw create --dry-run does not discover or preview create hooks.
Arashi owns Git worktrees. External cleanup must not remove the same worktree independently.