Merge upstream repository with my fork

I’m totally new to GitHub. I have just started working on a project where the client asked me to fork their repository and work on it. I downloaded the Github desktop app and managed to do this.

Now, the client found out that my fork does not have the latest changes from their main branch, so they asked me to merge the main branch with my fork.

I have been looking around for how to to this and I found these two articles:

I’m really confused now and have several questions:

  1. Which of the above articles do I need to follow
  2. What is the difference between the two (That is merging an upstream repository and syncing a fork)
  3. Both the articles above suggest using the git bash. Is there some way to achieve what I want via the GitHub desktop app?

Any help would be greatly appreciated!

Thanks in advance!

Hi @learnjavawithreshma, welcome to the GitHub Support Community!

Both of these help articles actually explain how to do mostly the same thing: merge an upstream branch into your own local copy. They just use slightly different commands to do so.

The “Syncing a fork” article is more for beginners, including adding the parent of your fork as a new remote and specifically targeting the master branch and giving you commands to use to sync that. The other article assumes you already have knowledge of these things and doesn’t explain as much, but it does do pretty much the same thing!

As for GitHub Desktop, I don’t have an article to share directly but Desktop should have some tools to help you with this. When you clone a fork it should give you some options on how you’re planning to use this fork, so I’d recommend giving these choices a read and select the best option for your project:

As for actually syncing your fork, from the branch selector dropdown you can choose a branch to merge into your currently checked-out branch using the button at the bottom:

You should see an option named upstream/master (or main or whatever default branch your project uses). If you select this option it will pull in any changes from the upstream parent repository allowing you to sync your fork with the upstream.

Doing this should update your local repository—and therefore your own fork—with any changes made to the original parent.

Thank you so much for the detailed explanation. I will give it a try!