You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 12, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on May 12, 2026. It is now read-only.
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).
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 🤔
Activity
wezm commentedon Jan 18, 2024
I can see the motivation for this. Not quite sure how to implement it though. The issue is when cloning
~/src/github.com/muescha/repowithgit grabhow does it know that it is related to~/src/github.com/otheruser/repo🤔ccoVeille commentedon Apr 3, 2024
What about the following pattern ?
I'm doing it often.
Let's assume there is repository named
fooinsomeuserSo a github.com/someuser/foo
Either if you have a fork or not yet.
I would use
ghis 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?
ccoVeille commentedon Apr 3, 2024
@muescha does it work for you? Was it what you were looking for?
muescha commentedon Apr 3, 2024
@ccoVeille, indeed!
gh repo forkwas the missing piece :)Here's how I typically handle my workflow:
~/Work/github.com/someuser/foo, perhaps just for testing purposes.~/Work/github.com/muescha/foo.I'll try your suggestion with
gh repo forkand then move it under mygithub.com/folder. Maybe I can accomplish this withmv . ../muescha/..muescha commentedon Apr 3, 2024
I how my changes stay in place :)
ccoVeille commentedon Apr 3, 2024
I'm happy it helped you.
gh repo forkwas also a great discovery for me. It works with any existing cloned repository.Then you only have to use the
gh pr createand everything is all set