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

Skip to content

Conversation

@majiayu000
Copy link

Summary

When specifying a repository for gh repo set-default, users can now use a git remote name (e.g., "origin", "upstream") instead of the full OWNER/REPO format.

Changes

  • Modified argument parsing to first check if the argument is a git remote name
  • If found as a remote name, uses the corresponding repository
  • Falls back to OWNER/REPO format if not found as a remote
  • Added documentation example for using remote names
  • Added test case for remote name argument

Example

# Before: had to use full repo format
gh repo set-default myorg/some-repo-name

# Now: can also use remote name
gh repo set-default origin

Test plan

  • Added test case for "remote name argument"
  • All existing tests pass
  • Updated help example to show remote name usage

Fixes #9149

When specifying a repository for `gh repo set-default`, users can now
use a git remote name (e.g., "origin", "upstream") instead of the
full OWNER/REPO format.

The command first checks if the argument is a git remote name. If
found, it uses the corresponding repository. Otherwise, it falls
back to parsing the argument as OWNER/REPO format.

Example:
  gh repo set-default origin

Fixes cli#9149

Signed-off-by: majiayu000 <[email protected]>
@majiayu000 majiayu000 requested a review from a team as a code owner December 26, 2025 11:21
@majiayu000 majiayu000 requested a review from babakks December 26, 2025 11:21
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label Dec 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

improve gh repo set-default to work with remote names

2 participants