home/common/programs/ai/pi-coding-agent/skills/git-worktrees/SKILL.md
Git worktree conventions and commands. Use when creating, switching to, or cleaning up git worktrees for branch work.
npx skillsauth add megalithic/dotfiles git-worktreesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Do branch work in git worktrees under <repo>/.worktrees/<branch>, not in the main checkout. Pi runs non-interactive bash tool calls, so do not rely on Fish aliases/functions like gwnew, gwpr, gwcd, gwprune, git-worktree-*.
repo_root=$(git rev-parse --show-toplevel)
mkdir -p "$repo_root/.worktrees"
git worktree add "$repo_root/.worktrees/$branch" -b "$branch"
repo_root=$(git rev-parse --show-toplevel)
mkdir -p "$repo_root/.worktrees"
pr_number=$(gh pr list --state open --head "$branch" --json number --jq '.[0].number')
git fetch origin "pull/$pr_number/head:$branch"
git worktree add "$repo_root/.worktrees/$branch" "$branch"
git worktree remove "$repo_root/.worktrees/$branch" --force
git branch -D "$branch" # only if branch exists
Each bash call starts from session cwd:
cd "$repo_root/.worktrees/$branch" && <command>
testing
Apply Strunk's timeless writing rules to ANY prose humans will read - documentation, commit messages, error messages, explanations, reports, or UI text. Makes your writing clearer, stronger, and more professional.
tools
Web search using DuckDuckGo (free, unlimited). Falls back to pi-web-access extension for content extraction.
tools
Interact with web pages using agent-browser CLI. MUST run 'browser connect 9222' FIRST to use existing browser with authenticated sessions.
tools
Remote control tmux sessions for interactive CLIs (python, gdb, etc.) by sending keystrokes and scraping pane output.