Checkout PR branches from GitHub and add to machete layout
/plugin marketplace add settlemint/agent-marketplace/plugin install crew@settlemint[--mine | --all | --by=<user> | PR numbers]git/<worktree_status>
!${CLAUDE_PLUGIN_ROOT}/scripts/git/worktree-context.sh 2>&1
</worktree_status>
<stack_context>
!${CLAUDE_PLUGIN_ROOT}/scripts/git/machete-context.sh 2>&1
</stack_context>
If no argument provided:
AskUserQuestion({
questions: [
{
question: "Which PRs do you want to checkout?",
header: "PRs",
options: [
{
label: "My PRs (Recommended)",
description: "All open PRs authored by you",
},
{
label: "All open PRs",
description: "All open PRs in the repository",
},
{ label: "Specific PRs", description: "Enter PR numbers" },
{ label: "By author", description: "PRs by a specific user" },
],
multiSelect: false,
},
],
});
# Show available PRs based on selection
case "$selection" in
"My PRs")
gh pr list --author @me --state open --json number,title,headRefName
;;
"All open PRs")
gh pr list --state open --limit 20 --json number,title,headRefName,author
;;
"By author")
# Prompt for username
gh pr list --author "$username" --state open --json number,title,headRefName
;;
esac
For your own PRs:
git machete github checkout-prs --mine
For all open PRs:
git machete github checkout-prs --all
For specific PRs:
git machete github checkout-prs 123 456 789
For PRs by a specific author:
git machete github checkout-prs --by=username
When checking out PRs, git-machete:
rebase=no push=no qualifiers for branches not authored by yougit machete status --list-commits
After checkout, you may want to sync:
AskUserQuestion({
questions: [
{
question: "Sync the checked-out stack with latest changes?",
header: "Sync",
options: [
{ label: "Yes", description: "Run traverse to sync all branches" },
{ label: "No", description: "Keep branches as-is" },
],
multiSelect: false,
},
],
});
If yes:
Skill({ skill: "crew:git:traverse" });
</process>
<qualifiers>
When checking out someone else's PRs, branches are automatically annotated:
feature-branch PR #123 rebase=no push=no
Qualifiers meaning:
rebase=no — Don't rebase this branch during traverse (you don't own it)push=no — Don't push this branch during traverse (you don't own it)To remove qualifiers (if you take ownership):
git machete anno <branch> ""
# Or keep just the PR annotation:
git machete anno <branch> "PR #123"
</qualifiers>
<use_cases>
Review someone's stacked PRs:
git machete github checkout-prs --by=colleague
git machete status --list-commits
Resume work on your own PRs from another machine:
git machete github checkout-prs --mine
git machete traverse -W -y
Checkout a specific PR chain:
# Checkout PR and its dependencies
git machete github checkout-prs 456
</use_cases>
<success_criteria>
git machete status shows correct tree</success_criteria>