Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Confusing behavior when BRANCH is a non-existent branch in gh issue develop -b BRANCH ISSUE #9469

@spenserblack

Description

@spenserblack

Describe the bug

$ gh --version
gh version 2.54.0 (2024-08-01)
https://github.com/cli/cli/releases/tag/v2.54.0

I mistakenly used -b instead of -n to specify the name of the branch to create. Naturally, the branch doesn't exist, so the argument passed for -b is invalid. However, the command completes successfully, seemingly using the primary branch as the base. While my confusion was mixing up -b and -n, the deeper issue is that -b accepts branches that don't exist.

Steps to reproduce the behavior

gh issue develop -b does-not-exist-on-remote 1

Expected vs actual behavior

Instead of falling back to using the primary branch as the base for the development branch, I would expect to get an error saying something like "branch does-no-exist-on-remote does not exist on the remote".

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocsgh-issuerelating to the gh issue commandhelp wantedContributions welcomep3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions