Skip to content

improve gh repo set-default to work with remote names #9149

@jtnord

Description

@jtnord

when using multiple repos (forks) you often need to change the default remote.

this can be accomplished with gh repo set-default [HOST/]OWNER/REPO (or via an interactive UI) however sometimes you just want to type (but type less).

I would suggest an improvement where in addition to allowing [HOST/]OWNER/REPO the command would also take a remote name from which it can (if needed) extract the needed info.

e.g.

given

❯ git remote -v
jtnord  https://github.com/jtnord/some-repo-name.git (fetch)
jtnord  https://github.com/jtnord/some-repo-name.git (push)
octocat https://github.com/octocat/some-other-repo-name.git (fetch)
octocat https://github.com/octocat/some-other-repo-name.git (push)
origin  https://github.com/myorg/some-repo-name.git (fetch)
origin  https://github.com/myorg/some-repo-name.git (push)

instead of gh repo set-default myorg/some-repo-name I should be able to use gh repo set-default origin
likewise instead of gh repo set-default octocat/some-other-repo-name I should be able to use gh repo set-default octocat

Metadata

Metadata

Assignees

Labels

enhancementa request to improve CLIgh-reporelating to the gh repo commandhelp wantedContributions welcome

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions