Stream: helpdesk (published)

Topic: convert dev'd package into fork


view this post on Zulip Leandro Martínez (Jan 05 2024 at 01:15):

Julia provides the standard way to develop a package, which is dev Pkg, automatically cloning the repository into .julia/dev/. However, when one does this with a package one do not own, how is the proper way to proceed?

Currently I'm skipping the automatic clone given by dev Pkg and first forking it, then cloning my fork into .julia/dev/.

Is there are a more direct way to do that? Meaning, is there a way to dev a package and convert the local clone into a fork in one's github repository?

I found this slack answer: https://stackoverflow.com/questions/33817118/github-how-to-fork-after-cloning

But that seems way too cumbersome. What do you frequent contributors to third-party packages do?

view this post on Zulip Mosè Giordano (Jan 05 2024 at 06:42):

I use magit with git forge integration, I think creating the fork is as hard as typing c f giordano or something like that, and it can automatically set the fork as default push remote

view this post on Zulip Mosè Giordano (Jan 05 2024 at 06:48):

And setting fetch/push remotes appropriately is better than renaming the remotes as suggested in the stackoverflow answer, as those operations will by default use the right remote, without you having to remember to pull from/push to the right one

view this post on Zulip Mosè Giordano (Jan 05 2024 at 06:49):

Magit is in emacs so I don't really recommend it to someone who isn't already invested in emacs, but it's by far the best interface to git I've ever used (although not entirely flawless)

view this post on Zulip jar (Jan 05 2024 at 07:03):

Fwiw I've given magit to someone who doesn't use emacs and they got on fine

view this post on Zulip Timothy (Jan 05 2024 at 07:11):

Magit seems like it would be worth being a standalone app, i.e. a specially configured "Emacs" that just runs magit.

view this post on Zulip Leandro Martínez (Jan 05 2024 at 12:54):

Out of curiosity, do you use VSCode or keep full time in emacs?

view this post on Zulip Mosè Giordano (Jan 05 2024 at 13:08):

I use only emacs

view this post on Zulip jar (Jan 05 2024 at 18:39):

All my coding is in vscode now. The vscode port https://github.com/kahole/edamagit has a good fraction of magit's functionality so most of the time I can stay in vscode.

view this post on Zulip Gunnar Farnebäck (Jan 06 2024 at 12:08):

The easiest way I've found to do this without magic tools is the following:

  1. Pkg.dev -> getting a clone in .julia/dev.
  2. Go to GitHub page and create a fork.
  3. Change to the package directory and do git remote add gunnar FORK_URL.
  4. git checkout -b FEATURE_BRANCH
  5. git commit until you're ready.
  6. git push -u gunnar HEAD.
  7. Go to GitHub and click on the "create PR" button at the top of the repo.

Step 3 can be done at any time between step 2 and step 6. Other people would name the remote differently.

view this post on Zulip isentropic (Jan 22 2024 at 04:27):

Gunnar Farnebäck said:

The easiest way I've found to do this without magic tools is the following:

  1. Pkg.dev -> getting a clone in .julia/dev.
  2. Go to GitHub page and create a fork.
  3. Change to the package directory and do git remote add gunnar FORK_URL.
  4. git checkout -b FEATURE_BRANCH
  5. git commit until you're ready.
  6. git push -u gunnar HEAD.
  7. Go to GitHub and click on the "create PR" button at the top of the repo.

Step 3 can be done at any time between step 2 and step 6. Other people would name the remote differently.

I prefer clonining the fork and adding upstream as a remote instead, and this way you wouldn't accidentally push into the upstream if you happen to have rights to it.


Last updated: Nov 22 2024 at 04:41 UTC