Skip to content

feat: add --branch flag to repo checkout for issue #1869#1951

Open
CtxAnsel wants to merge 2 commits intomultica-ai:mainfrom
CtxAnsel:feature/add-branch-flag-to-checkout
Open

feat: add --branch flag to repo checkout for issue #1869#1951
CtxAnsel wants to merge 2 commits intomultica-ai:mainfrom
CtxAnsel:feature/add-branch-flag-to-checkout

Conversation

@CtxAnsel
Copy link
Copy Markdown

Summary

Add --branch / -b flag to multica repo checkout command, allowing users to specify which branch to check out instead of using the remote default branch.

Requested in issue #1869.

Changes

  • CLI (cmd_repo.go): Add --branch / -b flag; pass through to daemon request
  • Daemon (health.go): Add Branch field to repoCheckoutRequest; forward to repocache
  • Repocache (cache.go): Accept optional Branch in WorktreeParams; if specified, validate branch exists in remote and use it as worktree base ref
  • Add verifyBranchExists() helper to validate branch existence before use

Usage

# Check out specific branch
multica repo checkout https://github.com/org/repo --branch dev

# Default behavior unchanged (uses remote default branch)
multica repo checkout https://github.com/org/repo

Testing

Works with existing bare repo cache; user-specified branch is validated against origin/<branch> ref before use.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 30, 2026

@CtxAnsel is attempting to deploy a commit to the IndexLabs Team on Vercel.

A member of the Team first needs to authorize it.

@CtxAnsel CtxAnsel marked this pull request as draft April 30, 2026 13:24
Adds -b/--branch flag to 'multica repo checkout' to allow specifying
which branch to check out. When not provided, defaults to the
existing auto-generated agent branch behavior.

Implements feature requested in multica-ai#1869.
@CtxAnsel CtxAnsel force-pushed the feature/add-branch-flag-to-checkout branch from c886ae5 to 53b68ec Compare April 30, 2026 13:32
When --branch is specified for an existing remote branch, use
'git worktree add' (without -b) to check it out directly,
rather than failing with 'branch already exists'.

Also adds branchExists() helper and removes the now-obsolete
branch collision retry logic in createWorktree().
@CtxAnsel CtxAnsel marked this pull request as ready for review April 30, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant