Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.
This repository was archived by the owner on May 12, 2026. It is now read-only.

Fork and Grab #12

Closed
Closed

Description

@muescha

I often fork repositories on GitHub and then retrieve them.

Here are the steps I'd like to follow:

  • Fork the repository on GitHub, and then git grab with my username.

  • If there is already a cloned repository at ~/src/github.com/otheruser/repo, instead of performing a git clone, I would like to locally move the existing directory using mv and adjust the remote repositories (origin to my repository and upstream to otheruser).

Activity

  1. wezm commented on Jan 18, 2024

    @wezm
    Owner

    I can see the motivation for this. Not quite sure how to implement it though. The issue is when cloning ~/src/github.com/muescha/repo with git grab how does it know that it is related to ~/src/github.com/otheruser/repo 🤔

  2. ccoVeille commented on Apr 3, 2024

    @ccoVeille

    What about the following pattern ?

    I'm doing it often.

    Let's assume there is repository named foo in someuser

    So a github.com/someuser/foo

    Either if you have a fork or not yet.

    I would use

    git grab someuser/foo
    gh repo fork
    

    gh is the GitHub CLI tool.

    This would fetch someuser/foo in ~/src/github.com/someuser/foo/

    origin would be youruser/foo
    upstream would be someuser/too

    I would say it's OK to work in the folder of the "owner" locally, even if you push on your branch

    Is it what you are trying to achieve?

  3. ccoVeille commented on Apr 3, 2024

    @ccoVeille

    @muescha does it work for you? Was it what you were looking for?

  4. muescha commented on Apr 3, 2024

    @muescha
    ContributorAuthor

    @ccoVeille, indeed! gh repo fork was the missing piece :)

    Here's how I typically handle my workflow:

    • Sometimes I already have this checked out at ~/Work/github.com/someuser/foo, perhaps just for testing purposes.
    • Then, I realize I want to make some changes. Since I can't push directly to the repository, I need to create a fork.
    • The idea is to fork it and then replace it with ~/Work/github.com/muescha/foo.

    I'll try your suggestion with gh repo fork and then move it under my github.com/ folder. Maybe I can accomplish this with mv . ../muescha/..

  5. muescha commented on Apr 3, 2024

    @muescha
    ContributorAuthor

    I how my changes stay in place :)

  6. ccoVeille commented on Apr 3, 2024

    @ccoVeille

    @ccoVeille, indeed! gh repo fork was the missing piece :)

    Here's how I typically handle my workflow:

    • Sometimes I already have this checked out at ~/Work/github.com/someuser/foo, perhaps just for testing purposes.
    • Then, I realize I want to make some changes. Since I can't push directly to the repository, I need to create a fork.
    • The idea is to fork it and then replace it with ~/Work/github.com/muescha/foo.

    I'll try your suggestion with gh repo fork and then move it under my github.com/ folder. Maybe I can accomplish this with mv . ../muescha/..

    I'm happy it helped you.

    gh repo fork was also a great discovery for me. It works with any existing cloned repository.

    Then you only have to use the gh pr create and everything is all set

  7. Repository owner locked and limited conversation to collaborators on Apr 5, 2024
  8. converted this issue into a discussion #17 on Apr 5, 2024
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions