Maslow Home Maslow Community Garden Newsletter

Github Question About Forks and Branches

@joshua has a fork of the firmware that contains holey calibration work. I have a fork that contains optical calibration work. I would like to make modifications to @joshua’s branch but I can’t “fork” it into my repo because I already have a fork of the firmware.

Without creating another repository, how can I get a copy of @joshua’s firmware and work on it and still stay connected to the maslowcnc/firmware?

The only thing I came up with is have someone create a branch in maslowcnc/firmware called holeyfirmware and have @joshua merge his branch into it. Then, because I have a fork of maslowcnc/firmware, I should be able to work on his branch. Would this work?

One thing that needs to be done is to update the holey calibration’s firmware to match the work on the master… it’s ~20 commits behind at the moment (e.g., missing the eeprom work, etc.)

1 Like

I don’t think so. I believe I have merged all updates in, unless you guys have been really productive in the last week.

It would seem like branches are the appropriate solution here. At some point, I have found that there is quite a bit more flexibility if you actually download git, and use the software outside of GitHub.

Well, that’s weird… because what I thought I downloaded and used was your latest… maybe something got messed up in the process, but looking at your repo it looks close to up to date.

1 Like

Well, who the **** knows what I was working on today because even my manually created fork of @joshua’s fork (without connection to maslowcnc/firmware) has the changes. I’ll have to check the other computer and see what’s going on.

Regardless, I can’t directly edit and submit a PR to @joshua’s branch because I can’t fork it as I already have a fork of maslowcnc/firmware… correct?

1 Like

Sorry for spam, but it looks like I was editing an old version of firmware and saw things were missing… so I went to your repo on github and saw:

This branch is 12 commits ahead, 22 commits behind MaslowCNC:master.

So, I guess I assumed your fork wasn’t up to date (as I thought I was editing it… but apparently not).

Is there a ready means to determine what 22 commits aren’t incorporated? Or do I just not understand correctly… a very distinct possibility.

Edit - @madgrizzle, tl,dr trhe following - you’re way beyond needing the following. I’ll leave it for others.

What tool are you using to manage your local repositories? If you’re using GitHub Desktop, you can use ‘Open in Desktop’ from the ‘Clone or download’ dialog in github:
39%20PM

then when GitHub Desktop responds with a dialog:

create a new local path that is different from your own normal path. Here, I created the local path above for a fork of @Joshua’s repo.

To go further, you’ll really want to start using branches for working on things in your local repos. If I were you, I would checkout ‘master’ in your local madgrizzle/Firmware repo in GitHub Desktop and create a branch from it, named to describe the end you intend for this task - something like ‘merge-into-joshua’. Ditto in the schmittrjoshc/Firmware local repo - ‘merge-from-madgrizzle’. Checkout the source repo/branch, copy some files, checkout the destination repo/branch and paste the files, then look at the ‘Changes’ list in the destination. Use branches in the destination to make smaller groups of changes, to make understanding the scope easier and selective rollback possible.

1 Like

Here are the changes to Maslow/Firmware/master that Joshua’s master lacks.
Here are the changes that Joshua’s repo would bring.

git is extremely flexible, there is actually nothing special about any branch or
upstream

you can add additional remotes to a repo and pull from one, push to another, etc
https://help.github.com/en/articles/configuring-a-remote-for-a-fork

what I commonly do is to fork in github
clone from the original
setup a new remote for my fork, called ‘push’

then I can pull/merge from the upstream and then push to my fork with ‘git push
push’ and then go to github to create the PR

in your case, create an additional remote that points at Joshua’s fork, create a
new local branch, then do a git fetch from it (to pull everything down into your
repo)

now you can do git diff between your stuff and his stuff and upstream stuff as
they are all just branches in your repo.

just be careful what branch you are on when you do a pull or a push.

David Lang