Interview Prep/Git & GitHub/Conflicts, remotes, fetch, pull and push

How do you keep a fork in sync with the original repo?

BeginnerConceptConflicts, remotes, fetch, pull and push
Answer

Add the original as upstream, fetch it, then merge or rebase and push to your fork. GitHub also has a Sync fork button and gh repo sync.

git fetch upstream
git switch main && git merge --ff-only upstream/main
git push origin main
All Git & GitHub questions Roadmap: Git & GitHub

More on Conflicts, remotes, fetch, pull and push