Skip to content

feat(repo clone): add --no-upstream flag#12527

Open
LouisLau-art wants to merge 2 commits intocli:trunkfrom
LouisLau-art:feat-repo-clone-no-upstream
Open

feat(repo clone): add --no-upstream flag#12527
LouisLau-art wants to merge 2 commits intocli:trunkfrom
LouisLau-art:feat-repo-clone-no-upstream

Conversation

@LouisLau-art
Copy link

Fixes #8274.

This PR adds a --no-upstream flag to the repo clone command.

When cloning a fork, GitHub CLI currently adds the parent repository as an upstream remote by default. This flag allows users to skip this behavior and only clone the repository with the default origin remote.

Changes:

  • Added NoUpstream to CloneOptions.
  • Added --no-upstream flag to the command.
  • Updated cloneRun to skip upstream logic if the flag is provided.
  • Added unit tests and a functional test to verify the new behavior.

Allow users to skip adding an upstream remote when cloning a fork. This is useful for users who want to clone their fork without automatically tracking the parent repository.
@LouisLau-art LouisLau-art requested a review from a team as a code owner January 23, 2026 16:05
@LouisLau-art LouisLau-art requested a review from BagToad January 23, 2026 16:05
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label Jan 23, 2026
@BagToad
Copy link
Member

BagToad commented Jan 23, 2026

Hey @LouisLau-art, thanks for working on this. I noticed some indentation issues and it looks like it failed our linter as well. You'll probably need to run go fmt on the files.

@LouisLau-art
Copy link
Author

Thanks for the heads-up! I ran gofmt on the updated files and pushed the fix. Please take another look when you have a moment.

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.

gh repo clone without upstream

3 participants