Skip to content

feat(cli): add --git-branch flag to branches create command#5250

Merged
avallete merged 6 commits into
developfrom
claude/add-git-branch-option-JZJjz
Jun 8, 2026
Merged

feat(cli): add --git-branch flag to branches create command#5250
avallete merged 6 commits into
developfrom
claude/add-git-branch-option-JZJjz

Conversation

@avallete
Copy link
Copy Markdown
Member

@avallete avallete commented May 14, 2026

Adds support for explicitly specifying a git branch to associate with a new preview branch via the --git-branch flag in the supabase branches create command.

Changes

  • TypeScript CLI (next): Added gitBranch flag to the create command config with optional string value. The flag prefers explicitly provided values over auto-detected git branches from environment variables.
  • TypeScript CLI (legacy): Added gitBranch flag to the legacy branches create command for backward compatibility.
  • Go CLI: Added --git-branch flag support to the branches create command, respecting explicit values over auto-detected branches.
  • API integration: Updated the branch creation API request to include the git_branch field when provided.
  • Documentation: Updated SIDE_EFFECTS.md to reflect the new git_branch parameter in the API request body and added the flag to the documented command flags.
  • Tests: Added integration test coverage for the new flag and verified that explicit --git-branch values take precedence over auto-detected branches.

Implementation Details

The implementation follows a preference hierarchy: explicitly provided --git-branch flag values take precedence over auto-detected git branches (from GITHUB_HEAD_REF or local git state). This allows users to override auto-detection when needed while maintaining backward compatibility for existing workflows that rely on auto-detection.

https://claude.ai/code/session_01Vsgo83p6eooc7QUXuZXJVx

Closes: CLI-1465

claude added 2 commits May 14, 2026 14:33
Exposes the v1 API's git_branch field on `supabase branches create` in
the next shell. When provided, it overrides the git branch detected
from the local environment so users can explicitly associate a git
branch independent of the new branch's name.
Adds a --git-branch flag on `supabase branches create` in the Go CLI
and forwards it through the legacy TS proxy. When provided, the flag
takes precedence over the git branch auto-detected from the local
working directory.
@avallete avallete requested a review from a team as a code owner May 14, 2026 15:09
@coveralls
Copy link
Copy Markdown

coveralls commented May 14, 2026

Coverage Report for CI Build 27128097286

Coverage decreased (-0.02%) to 63.982%

Details

  • Coverage decreased (-0.02%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 36 coverage regressions across 3 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

36 previously-covered lines in 3 files lost coverage.

File Lines Losing Coverage Coverage
cmd/branches.go 30 17.09%
internal/utils/git.go 5 53.33%
internal/branches/create/create.go 1 85.19%

Coverage Stats

Coverage Status
Relevant Lines: 15856
Covered Lines: 10145
Line Coverage: 63.98%
Coverage Strength: 7.1 hits per line

💛 - Coveralls

Copy link
Copy Markdown
Member Author

@avallete avallete left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…nch-option-JZJjz

# Conflicts:
#	apps/cli/src/legacy/commands/branches/create/SIDE_EFFECTS.md
#	apps/cli/src/legacy/commands/branches/create/create.handler.ts
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 5, 2026

Supabase CLI preview

npx --yes https://pkg.pr.new/supabase@5250

Preview package for commit 29f1739.

@avallete avallete merged commit 142e6a1 into develop Jun 8, 2026
25 of 27 checks passed
@avallete avallete deleted the claude/add-git-branch-option-JZJjz branch June 8, 2026 10:21
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.

4 participants