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 `:
- Resolves PR via existing `GET /pulls/:number` to get head_branch and head_repo.
- `git fetch <head_branch>`
- `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.