-
Notifications
You must be signed in to change notification settings - Fork 7.3k
gh config base
a way to configure the base repo
#4859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@bchadwic The team discussed this feature offline and we all agreed that it is a great idea. We came up with a proposed UX design for this as well. Let us know what you think.
While the code refers to this feature as "base" repo we want to use "default" when displaying to the user as it has more meaning. Additionally we thought it would be nice to have a |
@samcoe Sounds great, I agree that Since dailying the command, I find I use After some thought, I'm ok with leaving out an exclusive view option if my concerns don't seem to be an issue. I only want to voice my experience with using this command before it gets officially implemented 👍 Let me know if that's the final design the team would like to go with, I'd be happy to do some work on this. Also I like the idea of |
Also a view option could serve as a list of available remotes Merely a suggestion...
|
@bchadwic I like the idea of a dedicated flag that will skip the prompt and just display the current default since I can imagine many users just forgetting their default and wanting to see what it is. I am not sure |
… is a working example of the teams design combined with cli#4859 (comment)
I have a suggestion for keeping this simpler. Literally the only design goals for this command right now are that it:
I would avoid adding much more functionality to this command; especially the kind that does different things in interactive and non-interactive modes. Primarily, I would avoid adding any kind of prompting behavior to the command, which would also alleviate the need for adding flags to disable the prompting behavior. Here's how I imagine the command would work: $ gh repo default
#=> "cli/cli"
$ gh repo default --reset
$ gh issue list
# (prompts you to select the new default) @samcoe What do you think? |
Would you still be able to pass in a remote name to set the default?
|
@mislav I can understand the desire to keep this simple, the reason I thought that this command should allow setting the default repo was to remove the responsibility of setting a default from other commands. In the example you listed the Having this one command be able to reset/set/list/etc is a lot of functionality which is why I proposed, offline in slack, introducing a new top level object of a Overall, I don't have strong opinions here but I do anticipate users asking for the feature of being able to set the default through this command. |
@bchadwic I personally can't see how that interface would add any value over the existing prompt that asks you to select the base repo. Here's what currently happens if I clone
Note that there was only a single git remote "origin" pointing to Furthermore, it should be much more clear to the user when choosing from a prompt that lists repositories as |
@samcoe Aah, gotcha! If the goal is that other commands will error out when there is ambiguity, then I agree that we should add more functionality to the new dedicated command. Then instead of
That's a worthwhile consideration! I agree it would make slightly more sense if these commands were nested under |
Ah I didn't do my due diligence; I thought that Given that this will be referred to by various commands, I think it now makes more sense for the new command to prompt the default without a flag. I say this to keep things intuitive for new users and to keep directions uniform given that this command will be similar to For example, when you run
Likewise when you run
Simple, and similar to what already exists:
I'm not attached to Also I'm unsure of what the message would be for non-interactive users. |
@bchadwic I agree with the approach of interactive by default, it is the norm with other commands. |
If the team likes the latest design mentioned then I can start revising my pr. @samcoe if
|
@bchadwic The team is onboard with the direction you proposed. The main concerns we want to make sure are covered:
Let me know if you have any further questions about the direction! |
@bchadwic Lets leave that behavior in place for now and address it in a follow up PR. In the future, in the scenario that there are two or more remotes and no default is selected we will want to error out and instruct the user to use this new command to set the default. |
@samcoe , I finished what seems to be the functionality the team is after. I'm not sure if it's ready for a final review but if you have the time, a look over would be greatly appreciated 😃 A couple things to note:
Thank you! |
… is a working example of the teams design combined with cli#4859 (comment)
@bchadwic We appreciate your hard work on this and patients on the follow through. In an effort to keep this from lingering on our side too long and wanting to see this shipped in the next release I went ahead and pushed a commit that does a couple things:
|
Thank you @samcoe ! I think the hold up has been on my side so I appreciate you doing the heavy lifting. I'll look through the code later to see how I could improve for next time 👍 |
my TODO:
|
I have updated this PR with some tweaked UX that could use a quick review. When there is only one possibility for base repository's value:
When there are multiple possibilities:
It's possible my mini-explainer should be in a help topic instead but I felt this was succint enough to leave in the command. I've also opened up the follow-up issue, #6729 , which I'll do once this is merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left two small comments, otherwise everything looks good to me pending the offline slack discussion around wording. We may still need to add a help topic for this feature in the future but I think that is something we can wait for user feedback on. Thanks for pushing this to the finish line! I am excited for this long standing PR to finally get merged!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great; thank you for picking this back up.
I like the added help blurb!
I got tired of modifying my
git config -e
to switch my base repo, so I made a command for personal use.After looking to see if others had similar problems, I found a lot of issues revolving the base repo and its obscurities.
I'm opening this to hopefully help all the future and current users who:
Secret created in Upstream Repo instead of Current Repo #4688
Unclear message about base repository when creating a PR #2090
How to change base repo for
gh pr
? #2300Allow configured Git remotes to be used for the '-R' argument #1481 Sorta related
gh "base repository" not worktree specific #1837
Document which remote is used for
:owner
,:repo
placeholders #2657 (comment) Good start to this functionalityI think with the amount of requests and the void in documentation about the base repo, something like this should be included in the tool.
It needs work and tests, but this is what it looks like in action: