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

@avallete avallete commented May 14, 2026

Copy link
Copy Markdown
Member

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

coveralls commented May 14, 2026

Copy link
Copy Markdown

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

@avallete avallete left a comment

Copy link
Copy Markdown
Member Author

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

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

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
mxcl pushed a commit to automic-vault/supabase-cli that referenced this pull request Jun 11, 2026
…#5250)

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
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