Skip to content

Repeating the command gh issue develop twice breaks config #12575

@bronius

Description

@bronius

Describe the bug

Issuing the command issue develop twice (once to create the remote branch, another time because I am a goofball) breaks local .git/config preventing any other git commands from succeeding until config is manually repaired.

Affected version

❯ gh --version
gh version 2.86.0 (2026-01-21)
https://github.com/cli/cli/releases/tag/v2.86.0

Steps to reproduce the behavior

  1. Type this gh issue develop 105 -bmain -nfeature/105-only-test-app-change-prs which creates the remote branch (and keeps you checked out in current branch)
  2. Repeat previous command: This attempts to recreate the branch but breaks config
  3. See error "fatal: bad config variable 'branch..gh-merge-base' in file '.git/config' at line"..

I got here by issuing gh issue develop ... like normal but realized I had neglected to also checkout the new branch. So I merely hit Up-arrow to repeat the command and added a -c flag to the previous command in hopes that gh cli would have noticed that the heavy lifting was already done and it merely needed to fetch and check out its branch.

Expected vs actual behavior

  • I expected that repeated gh issue develop would automatically detect having created a remote branch and attached to the issue and (with the newly added -c would have checked it out locally.
  • Instead, my .git/config file became corrupt with an entry like:
[branch ""]
	gh-merge-base = main

Workaround/fix: I manually edited and deleted those two lines (and manually fetched and checked out the new branch).

Logs

❯ gh issue develop 105 -bmain -nfeature/105-only-test-app-change-prs
github.com/MY_ORG/MY_REPO/feature/105-only-test-app-change-prs
From github.com:MY_ORG/aip-github-auth-app
 * [new branch]      feature/105-only-test-app-change-prs -> origin/feature/105-only-test-app-change-prs
❯ gh issue develop 105 -bmain -c -nfeature/105-only-test-app-change-prs
github.com/MY_ORG/MY_REPO/tree/
fatal: bad config variable 'branch..gh-merge-base' in file '.git/config' at line 89
failed to run git: exit status 128
❯ git fetch origin main:main
fatal: bad config variable 'branch..gh-merge-base' in file '.git/config' at line 89
❯ git pull
fatal: bad config variable 'branch..gh-merge-base' in file '.git/config' at line 89
❯ git st
On branch main
fatal: bad config variable 'branch..gh-merge-base' in file '.git/config' at line 89

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggh-issuerelating to the gh issue commandhelp wantedContributions welcomepriority-2Affects more than a few users but doesn't prevent core functions

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions