Skip to content

gh browse command should automatically run gh repo set-default if not yet configured #13006

Open

Description

@trueberryless

Describe the feature or problem you’d like to solve

When I clone a new fork repo (git clone <fork>), and add the upstream remote locally to have both (my fork and original) repo as remotes configured (git remote add upstream <original>), and I run gh browse for the first time, it always bothers me that I have to manually copy and paste the suggested gh repo set-default command, instead of gh browse just auto-executing the command for me, so I can select the default repo and it opens fluently.

Proposed solution

When I run gh browse I would expect that it automatically asks the CLI user to select the configuration for the default remote to open.

  • I'm willing to submit a PR which implements this feature request.

Activity

  1. williammartin commented on Mar 26, 2026

    @williammartin
    Member

    So look, on the surface, this seems reasonable to me. I don't know why we require an extra hop. Here's my problem:

    Unfortunately, neither of these maintainers are still at GitHub so I'm not sure we'll get an answer! @mislav or @vilmibm, is there any chance you remember why you made the decision to tear out the prompting for the base repo from the rest of the command set, in favour of an error and instructive message? No worries if it doesn't come to you immediately. Hope you're doing well 👌

  2. trueberryless commented on Mar 26, 2026

    @trueberryless
    Author

    Thanks for the response!

    I didn't now about the previous issues and changes regarding this behaviour, so sorry. I'm looking forward to any further infos or developments regarding this nonetheless. 👍

  3. williammartin commented on Mar 26, 2026

    @williammartin
    Member

    No worries, neither did I to be honest. It's a great issue, it's the kind of thing that after using gh for a while you glaze over. Useful feedback.

    Can I ask what your workflow is that you end up in this situation frequently? Are you doing git clone and then adding a fork remote? I ask because gh repo clone normally handles this for you.

  4. trueberryless commented on Mar 27, 2026

    @trueberryless
    Author

    No worries, neither did I to be honest. It's a great issue, it's the kind of thing that after using gh for a while you glaze over. Useful feedback.

    Thank you!

    Can I ask what your workflow is that you end up in this situation frequently? Are you doing git clone and then adding a fork remote? I ask because gh repo clone normally handles this for you.

    Yes, I use:

    1. git clone https://github.com/trueberryless/<fork>
    2. cd <fork>
    3. git remote add upstream https://github.com/<org>/<original>
    4. gh browse
    5. And then I need to run gh repo set-default

    I added this info to the issue description 🙌

    After I created the issue, I read somewhere (I think it was in one of the issues you linked to) that the workflow automatically works when using gh repo clone. I also didn't know that command before, I might try this out if we decide that this feature would lead to too many unnecessary imports 👍

  5. williammartin commented on Mar 27, 2026

    @williammartin
    Member

    Yes, if you gh repo clone the fork, it will set the default to the upstream automatically.

  6. added
    gh-browse
    enhancement
    on Mar 30, 2026
  7. removed
    needs-triage
    on Mar 30, 2026
  8. github-actions commented on Mar 30, 2026

    @github-actions
    Contributor

    Thank you for your issue! We have categorized it as an enhancement (feature or improvement) request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.

    Unless you see the help wanted Contributions welcome label, we are not currently looking for external contributions for this feature.

    If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.

  9. waldyrious commented on Sep 3, 2026

    @waldyrious
    Contributor

    EDIT: I moved the original contents of this comment to #8659, where it fits better.

    Assuming @trueberryless wants to continue using his existing workflow (git clone <fork> / cd <fork> / git remote add upstream <original> / gh browse), which btw also matches what happens when doing gh repo fork, i.e. the fork is under the remote name "origin" and the original repo is under the remote name "upstream", AFAIK the only way to bypass the need to run gh repo set-default is to do what @minrk suggested in #6827:

    add to ~/.gitconfig:

    [remote "upstream"]
        gh-resolved = base
    

    That way, the "upstream" will always be considered the default/base repository for PRs, browsing, etc.

    Beware that doing so will prevent overriding the config for specific repos via gh itself, due to #7770; however, such overrides can be added manually via git itself, e.g. git config remote.<foobar>.gh-resolved base, where <foobar> could be origin or whatever other name you'd want.

  10. trueberryless commented on Sep 3, 2026

    @trueberryless
    Author

    Thanks for the info!

    I actually mostly use gh repo clone <fork> now, and it works great for me. But I think this issue still is important for new contributors which might not know all those GitHub specific details.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgh-browse

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions