Skip to content

Fetch the created branch on gh issue develop #7588

Description

@Shion1305

Describe the feature or problem you’d like to solve

When creating a remote branch using gh issue develop, it seems that the created branch won't be automatically fetched in the local machine.

Proposed solution

Automatically fetch the created branch on gh issue develop after the remote branch is created on GitHub

Activity

  1. samcoe commented on Jun 19, 2023

    @samcoe
    Contributor

    @Shion1305 Thanks for writing in, the gh issue develop command already supports the --checkout flag which provides the functionality that you are requesting. Is there some functionality that you are looking for that the flag does not provide?

  2. added
    more-info-neededMore info needed from user/contributor
    and removed on Jun 19, 2023
  3. Shion1305 commented on Jun 19, 2023

    @Shion1305
    ContributorAuthor

    Hi @samcoe , thanks for your response.
    I agree with you that the --checkout flag allows the branch to be fetched and checkouted on the local machine.
    When we use the gh issue develop command without specifying the --checkout flag, the branch is created on the remote but isn't fetched on the local machine. I think this is unuseful for some users as they might expect the branch to be available locally as well.

  4. samcoe commented on Jun 19, 2023

    @samcoe
    Contributor

    @Shion1305 I think I understand better now. If the user wants to get started developing locally on the branch, and they have not specified the --checkout flag, then they must run git checkout -b <branch-name> correct? That command should implicitly fetch the branch, so I am not sure what value would be provided by doing the fetch inside of the issue develop command.

  5. Shion1305 commented on Jun 19, 2023

    @Shion1305
    ContributorAuthor

    @samcoe I did't know that git checkout -b <branch-name> will automatically run fetch. I usually use switch command when creating local branch from remote branch. I encountered the situation that I use gh issue develop without using --checkout flag and after that failed to create local branch with git switch command. And I thought it would be better to automatically fetch the created branch on gh issue develop command.

  6. Shion1305 commented on Jun 19, 2023

    @Shion1305
    ContributorAuthor

    Well, I think git checkout -b <branch-name> creates a new branch without link to remote branch, so users who uses gh issue develop may want to use git checkout rather than git checkout -b

  7. samcoe commented on Jun 19, 2023

    @samcoe
    Contributor

    @Shion1305 You are correct, git checkout without the -b flag.

  8. samcoe commented on Jun 19, 2023

    @samcoe
    Contributor

    @Shion1305 I just tried using git switch and it does not work, so that is kind of a shame that it does not have the same behavior as git checkout. Having said that I think using git switch is probably pretty common workflow so we should support it. I am open to adding the git fetch automatically to the issue develop command.

  9. added and removed
    more-info-neededMore info needed from user/contributor
    on Jun 19, 2023
  10. Shion1305 commented on Jun 19, 2023

    @Shion1305
    ContributorAuthor

    @samcoe I appreciate your understanding! I've already submitted a PR that implements this change. #7589
    If you have the time, I'd really appreciate it if you could take a look at the PR and provide any feedback or suggestions. Thanks!

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 CLIhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions