Repository navigation
Rename command does not indicate it won't change the organization #8147
Description
Activity
- changed the title
[-]Rename command does not indicate it won't change the organizatio[/-][+]Rename command does not indicate it won't change the organization[/+]on Oct 6, 2023 repo renameseems like a cool command! (love how I have something new to discover every day with the GitHub CLI)I noticed a difference in behavior when there's a prompt (interactive renaming) to rename, and when the new repository name is supplied as a command line argument.
Interactive renaming
- There's no confirmation about the rename process.
- Organization name is not stripped out.
➜ codewars git:(main) ✗ gh repo rename ? Rename arunsathiya/codewars to: arunsathiya/codewars-solutions ✓ Renamed repository arunsathiya/arunsathiya-codewars-solutions ✓ Updated the "origin" remoteNew repository name passed as an argument
- There is a confirmation about the rename process.
- Organization name appears to be stripped out at the time of confirmation, but it is not actually stripped out after the command is run.
➜ codewars git:(main) ✗ gh repo rename arunsathiya/codewars-solutions ? Rename arunsathiya/codewars to arunsathiya/codewars-solutions? Yes ✓ Renamed repository arunsathiya/arunsathiya-codewars-solutions ✓ Updated the "origin" remote ➜ codewars git:(main) ✗ git remote -vv origin [email protected]:arunsathiya/arunsathiya-codewars-solutions.git (fetch) origin [email protected]:arunsathiya/arunsathiya-codewars-solutions.git (push)I agree with the overall feedback that this needs to be improved @jlengrand. 👍🏼
Specific actions that I propose we can take:
- Show a confirmation when interactive renaming as well, to match the behavior on scripting approach (command line argument approach)
- ALWAYS strip out organization name.
Happy to explore and submit a PR once a member of the CLI team gets to review this issue.
- addedenhancementa request to improve CLIa request to improve CLIgh-reporelating to the gh repo commandrelating to the gh repo commandand removedneeds-triageneeds to be reviewedneeds to be reviewed
on Oct 9, 2023 @jlengrand : Thank you for the kind words and opening up this issue for improving the repo naming command!
Let me take a few of your points one-by-one:
- You write the name of the repo INCLUDING org, I thought I had to retype it.
I understand why you might think the user or organization owner needed to also be provided.
The GitHub CLI prints the name with owner in order for you to verify this is the intended repository as the command can be invoked with and without that information.
Perhaps this single prompt can be first print the repository name with owner and ask specifically what the new repository name should be.
- You do not warn that the organization will not change
How might we reinforce this is specifically for renaming repositories rather than transferring repositories? Is there something more that could be added to the help usage documentation?
$ gh repo rename --help Rename a GitHub repository. By default, this renames the current repository; otherwise renames the specified repository.- You are also modifying unallowed characters ("/") into - apparently (which is cool).
This makes me think we should do some validation for
/rather than translating all of them into hyphens. I'm not sure offhand how the GitHub UI behaves when you try to rename a repository with a/🤔Reacted by julien Lengrand-Lambert- addedmore-info-neededMore info needed from user/contributorMore info needed from user/contributor
on Oct 9, 2023 The GitHub CLI prints the name with owner in order for you to verify this is the intended repository as the command can be invoked with and without that information.
Understood, that makes sense to me. It's actually good DX.
How might we reinforce this is specifically for renaming repositories rather than transferring repositories? Is there something more that could be added to the help usage documentation?
That would definitely be a good idea, though in my case it wouldn't have helped. You fall victim of your own success here ^^, your naming is so good that I randomly typed the command first time and it just was there where I expected it to be so I never actually used the help command.
Perhaps this single prompt can be first print the repository name with owner and ask specifically what the new repository name should be.
Maybe one line about which repo you're on, and a second with only the renaming part would help reducing confusion?
$ gh repo rename ? Current repository is Adyen/adyen-java-api-library. ? Rename adyen-java-api-library to:Another idea would be to add the context by providing the organization as part of the input already:
$ gh repo rename ? Rename adyen-examples/adyen-java-api-library to: adyen-examples/This makes me think we should do some validation for / rather than translating all of them into hyphens. I'm not sure offhand how the GitHub UI behaves when you try to rename a repository with a / 🤔
I don't think
/is a valid character for repositories? Or is it?
Another idea would be to add the context by providing the organization as part of the input already:
❤️ I like this idea, vs my previous proposal of stripping out the organization name behind the scenes.
Reacted by julien Lengrand-LambertHi @andyfeller, I'd like to work on @jlengrand's second suggestion in this comment. Is that the direction the CLI team would like to take? I'd like a confirmation before starting to work on this! 🙏🏼
@arunsathiya @jlengrand I would like to make another suggestion on approach here, instead of changing the prompt as it currently is what about having a confirmation step after the new name has been input?
Interestingly enough this command already has a confirmation prompt which, I think by mistake, is not active in interactive mode. We could easily change it so that in interactive mode the confirmation step is necessary unless the user specifies the
--yesflag.Interestingly enough this command already has a confirmation prompt which, I think by mistake, is not active in interactive mode.
That matches what I found originally as well. 👍🏼 I still feel that including the organization name in the prompt would be an excellent UX improvement, but I am happy to start working on the confirmation prompt.
I also thought of including the organization name in the confirmation prompt for the
repo deletecommand, but that is a bit different in that, confirmation being a destructive action warrants a full address input (owner + repo). That also matches the pattern on GitHub UI itself. On the other hand, renaming a repo is something that happens within the same organization and including the organization name in the prompt feels like a better UX.I don't feel too strongly about it, but just wanted to document my thoughts.
- addedhelp wantedContributions welcomeContributions welcomeand removedmore-info-neededMore info needed from user/contributorMore info needed from user/contributor
on Nov 8, 2023
CLI Feedback
You can use this template to give us structured feedback or just wipe it and leave us a note. Thank you!
What have you loved?
The tool is amazing overall folks, this is just some feedback I'm giving :).
What was confusing or gave you pause?
I tried to rename a repository in an organization that isn't my main one.
What I wanted :
In the
adyen-examplesorg, rename themedium-statsrepo intomedium-stats-action.What happened instead : the
medium-statsrepo was renamed intoadyen-examples-medium-stats-action.This is because 👍
-apparently (which is cool).Are there features you'd like to see added?
Proposal (one of):
Anything else?
Thanks!