ref:main

anvil pr checkout <num> — fetch and check out a PR locally #12

open Opened by cole.christensen@gmail.com

Links

No links yet.

Problem

No standard forge-CLI affordance for checking out a PR. Today: figure out the remote branch name, `git fetch`, `git checkout` manually.

`gh pr checkout 123` is the bar.

Proposal

`anvil pr checkout `:

  1. Resolves PR via existing `GET /pulls/:number` to get head_branch and head_repo.
  2. `git fetch <head_branch>`
  3. `git checkout <head_branch>` (or detached-head if branch already exists locally with different content — match `gh` behavior).

Acceptance criteria

  • Single command runs fetch + checkout
  • Handles cross-repo PRs (head_repo != base_repo)
  • Errors gracefully outside a git repo
  • Refuses to overwrite uncommitted changes

Origin

CLI gap audit.