using-git-worktrees

Installation
SKILL.md

Using Git Worktrees

Overview

Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching.

Core principle: In opencode v2, worktrees are created with the native worktree_* tools, and the session moves into the worktree — not just the shell. This keeps opencode's tracking (list/remove), project config, and AGENTS.md discovery pointing at the right place.

Announce at start: "I'm using the using-git-worktrees skill to set up an isolated workspace."

Default Path: Native Worktree Tools

Use this when running inside opencode v2 (the normal case). The tools are worktree_create, worktree_list, worktree_remove (Code Mode namespace opencode), plus session_move.

1. Create the worktree

Call worktree_create with a name — use the feature/branch name (e.g. auth, fix-login-timeout). It returns { directory }.

Where the worktree lands is decided by the worktree.directory setting in the project's opencode config, not by the skill:

Installs
89
GitHub Stars
15
First Seen
May 31, 2026