Desktop - how to sync my fork's main branch with upstream's main branch?

GitHub Desktop makes it simple to configure a repository that is a fork of an “upstream” repository that the user does not write access to. This is very common for those who contribute to open source projects - contributors create a fork, clone their personal fork, make changes, and then open a pull request against the original, “upstream” repository.

It seems that when configured properly, GitHub Desktop will let you create a new branch based on the HEAD of the upstream’s main branch. What isn’t so simple to do is to sync your personal main branch with the upstream’s main branch - the “Fetch” button/tab will only sync against the user’s forked main branch.

Is there a simple way to sync the fork’s main branch with the upstream repo’s main branch? Or is this only possible via the command line:

$ git fetch --all
$ git checkout main
$ git pull upstream main

Welcome @adambkaplan!

GitHub Desktop fetches all of the upstream branches in your fork, so you should see them appear in the branch list as upstream/<branch>. You can select these branches when using the merge branch feature in GitHub Desktop to merge the changes from upstream into your fork.

There is a current issue where you are unable to checkout an upstream branch due to the existing main branch – this is being tracked in unable to checkout remote branch when existing local branch has the same name · Issue #4527 · desktop/desktop · GitHub.

Let me know if you have any other questions.