Skip to content

gh stack link does not respect the default branch of a repository #260

Closed

Description

@tylerjohnst

When linking an existing stack with gh link 1 2 3 and --base is not given, it defaults to main not the default repository branch. As a result, the first PR of the stack is retargeted to main and currently there is no easy way to change the base of the stack.

Activity

  1. self-assigned this
    on Jul 22, 2026
  2. skarim commented on Jul 22, 2026

    @skarim
    Collaborator

    link currently has a hardcoded default to main:

    cmd.Flags().StringVar(&opts.base, "base", "main", "Base branch for the bottom of the stack")

    but it should follow the same dynamic base branch resolution that is used in init:

    trunk, err = git.DefaultBranch()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugBug Reportstopic: cli - link`gh stack link`: create local tracking state, and PR-title defaults when linking.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions