How to Sync a Fork Branch with Github CLI

I love the Github CLI, it makes a lot of things easier!

One of my favorite ones is sync which I did not know about, but assumed it could do. Today I used it and it was wonderful:

gh repo sync owner/cli-fork -b BRANCH_NAME

And then you know your upstream repo is now synced down to your fork.

A couple of notes:

  • Syncing your fork only updates your local copy of the repository. to update your fork on Github.com you must push your changes
  • You have to setup the upstream first if you haven't to be able to to sync with the CLI like this
Updated Last:2023-04-05T14:54:40.000Z