Friday, November 29, 2019

Syncing forks on GitHub

I keep having problems with trying to sync my Marlin repo (forked from luc's) to his fork. It is usually a tedious process for me to fetch from upstream, then merge, and end up having a ton of conflicts that I need to manually resolve.

Then, I found the easy way here. I am just going to cut and paste the entire set of instructions just to help me in case I forget.
  1. Open your fork of the repository.
  2. Click the compare button.
    This will open a page titled Comparing Changes and if you look carefully you'll have jumped to the upstream version of the repository. If you were to do a regular pull request then this makes sense as you'd be bringing your changes into the upstream version. But in this case we want to flip the direction and pull changes from the original version to our fork.
  3. Change the base fork to your repository
  4. You're now back to your fork but you've also asked to compare two identical repositories so GitHub thinks you care about branches not forks. Click on compare across forks to get back your base fork option.
  5. Change the head fork to the upstream (original) repository
    Note at this point that if you were in control of everything at GitHub you would probably just have put a little button in between the base for and head fork that would have flipped them for you rather than doing all these clicks. You might even had added in a separate button to check for upstream changes! But they do know that this is a bit of a silly hack and they're working hard on a bunch of other cool stuff so we'll let them off this one.
  6. You'll see one of two options:
  • "There isn’t anything to compare" This means you're up to date and you don't have to do anything. Phew. :relieved:
  • A list of commits. These are the changes that have happened in the repository since you forked your version. Go to step 7.

  1. Create a pull request
    Note that this pull request is to you! So you can confirm that it's ok and merge it when necessary. And if there are any merge conflicts then it's up to you to figure out what's gone wrong and sort them out.
That's it!

After that, to update any local files on disk, I just need to go to the respective folders on my hard disk, and do a git pull.

No comments: