Get the FREE Ultimate OpenClaw Setup Guide →

checkout

Scanned
npx machina-cli add skill technicalpickles/pickled-claude-plugins/checkout --openclaw
Files (1)
SKILL.md
2.7 KB

Git Checkout

Overview

Check out a PR, branch, or ref into an isolated worktree with relevant context.

Announce: "Using git:checkout to set up a worktree for {target}..."

When to Use

  • User wants to review a PR locally
  • User wants to work on a specific branch in isolation
  • User provides PR URL/number or branch name
  • Following git:inbox when user picks a PR

Input Formats

Accept:

  • Full PR URL: https://github.com/{owner}/{repo}/pull/{number}
  • Short PR: {repo}#{number} or #{number} (infer repo from cwd)
  • PR number only: {number} (infer owner/repo from git remote)
  • Branch name: feature/auth, main, etc.
  • Ref: commit SHA, tag

Workflow

For PRs

1. Parse PR Reference

# Get owner/repo from current directory if needed
gh repo view --json owner,name -q '"\(.owner.login)/\(.name)"'

2. Fetch PR Details

gh pr view {number} --json title,body,author,state,baseRefName,headRefName,url,reviews,reviewRequests

3. Set Up Worktree

REQUIRED: Use superpowers:using-git-worktrees skill for directory selection.

# Fetch the PR branch
git fetch origin {headRefName}

# Create worktree
git worktree add .worktrees/pr-{number}-{short-desc} origin/{headRefName}

Naming: pr-{number}-{2-3-word-description} (e.g., pr-1234-add-oauth)

4. Present Context

## PR #{number} Ready for Review

**Title:** {title}
**Author:** @{author}
**Branch:** {headRefName} → {baseRefName}
**URL:** {full_url}

### Summary
{1-3 sentence summary from PR body}

### Files Changed ({count})
{Grouped by directory}

### Review Status
{Existing reviews, requested reviewers}

---

**Worktree ready at:** `{full_path}`

For Branches

1. Create Worktree

# For existing branch
git worktree add .worktrees/{branch-slug} {branch}

# For new branch
git worktree add .worktrees/{branch-slug} -b {branch}

2. Report Ready

**Worktree ready at:** `{full_path}`
**Branch:** {branch}

Quick Reference

InputAction
PR URL/numberFetch PR, create worktree, show PR context
Branch nameCreate worktree for branch
Ref/SHACreate worktree at that ref

Common Mistakes

MistakeFix
Creating worktree before fetching PR branchAlways git fetch first
Generic worktree nameInclude PR number AND short description
Missing PR contextAlways summarize PR and show review status

Related

  • superpowers:using-git-worktrees - Handles directory selection and verification
  • git:inbox - Discover PRs needing review
  • code-review - Guide the actual review process

Source

git clone https://github.com/technicalpickles/pickled-claude-plugins/blob/main/plugins/git/skills/checkout/SKILL.mdView on GitHub

Overview

Git checkout creates an isolated worktree for a PR, branch, or ref, bringing relevant context into a separate workspace. This enables local review, isolated development, and testing without altering your main working tree. It uses a PR context when applicable and follows a naming convention for quick identification.

How This Skill Works

The skill parses the input to identify the target (PR URL/number, branch name, or ref), fetches PR details when dealing with a PR, and then creates a new worktree with git worktree add. For PRs, it uses the pr-{number}-{2-3-word-description} naming scheme and leverages superpowers:using-git-worktrees for directory selection; for branches, it can create a worktree using the existing branch or with -b for a new branch.

When to Use It

  • Review a PR locally in isolation
  • Work on a specific branch without affecting the main tree
  • Provide a PR URL/number or branch name to set up context
  • Checkout a specific ref or commit SHA for testing
  • Follow git:inbox flow when selecting a PR for review

Quick Start

  1. Step 1: Determine your target (PR URL/number, branch name, or ref) from input
  2. Step 2: If working with a PR, fetch details (title, author, base/head) using gh pr view to prepare context
  3. Step 3: Create the worktree with git worktree add, naming it pr-{number}-{2-3-word-description} for PRs or using the branch name for branches; rely on superpowers:using-git-worktrees for directory selection

Best Practices

  • Always fetch the PR branch before creating the worktree
  • Name worktrees as pr-{number}-{2-3-word-description}
  • Always present PR context (title, author, base/repo, URL) in the worktree
  • Use superpowers:using-git-worktrees for directory selection
  • For branches, use git worktree add -b {branch} when creating a new branch

Example Use Cases

  • Review PR #1234 add-oauth in a dedicated worktree named pr-1234-add-oauth
  • Work on feature/auth in isolation without changing main
  • Check out PR URL https://github.com/org/repo/pull/77 and review context
  • Create a worktree for tag v1.2.3 to test release
  • Checkout commit SHA abc1234 to reproduce a bug locally

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers