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
upstream remote is automatically set to the upstream repository.
I also have these relevant settings in my
[merge] ff = only [push] default = current
Update the fork with changes in the upstream repo:
git checkout master git fetch upstream git merge upstream/master git push
If there are no conflicts,
the merge will apply cleanly and
master branch will be sync’ed
If there are conflicts, I’ll have to rebase and force push:
git checkout master git fetch upstream git rebase upstream/master [fix conflicts] git add . git rebase --continue git push -f