Update a GitHub Fork

After forking a GitHub repo to my personal account, I want to update the fork with changes in the "upstream" repo.


Get the GitHub CLI tool:

brew install github/gh/gh
brew update
brew upgrade gh

Fork the upstream repo:

gh repo fork org/project

The upstream remote is automatically set to the upstream repository.

I also have these relevant settings in my ~/.gitconfig:

  ff = only
  default = current


Update the fork with changes in the upstream repo:

git checkout main
git fetch upstream
git merge upstream/main
git push