Skip to content

Rename command does not indicate it won't change the organization #8147

Description

@jlengrand

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-examples org, rename the medium-stats repo into medium-stats-action.
What happened instead : the medium-stats repo was renamed into adyen-examples-medium-stats-action.

This is because 👍

  • You write the name of the repo INCLUDING org, I thought I had to retype it.
  • You do not warn that the organization will not change
  • You are also modifying unallowed characters ("/") into - apparently (which is cool).
image

Are there features you'd like to see added?

Proposal (one of):

  • Omit the org name in the command, to avoid confusion
  • Warn that the org does not have to be retyped
  • Allow for dynamic org name change

Anything else?

Thanks!

Activity

  1. 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
  2. arunsathiya commented on Oct 6, 2023

    @arunsathiya
    Contributor

    repo rename seems 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" remote
    

    New 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.

  3. Balmasexy commented on Oct 8, 2023

    @Balmasexy
  4. added
    enhancementa request to improve CLI
    gh-reporelating to the gh repo command
    and removed on Oct 9, 2023
  5. andyfeller commented on Oct 9, 2023

    @andyfeller
    Contributor

    @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 / 🤔

  6. jlengrand commented on Oct 9, 2023

    @jlengrand
    Author

    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?

    image
  7. arunsathiya commented on Oct 9, 2023

    @arunsathiya
    Contributor

    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.

  8. arunsathiya commented on Oct 17, 2023

    @arunsathiya
    Contributor

    Hi @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! 🙏🏼

  9. samcoe commented on Oct 18, 2023

    @samcoe
    Contributor

    @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 --yes flag.

  10. arunsathiya commented on Oct 18, 2023

    @arunsathiya
    Contributor

    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 delete command, 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.

  11. added and removed
    more-info-neededMore info needed from user/contributor
    on Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIgh-reporelating to the gh repo command

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions