Sync a Forked Repo

twitter logo github logo Originally published at tech.serhatteker.com on ・1 min read

Update a fork of a repository to keep it up-to-date with the upstream repository.

  1. Add the remote (original repo you forked) and call it upstream:
  $ git remote add upstream https://github.com/User/original-repo.git

or use SSH

  $ git remote add upstream git@github.com:User/original-repo.git
  1. Fetch all branches of remote upstream:
  $ git fetch upstream
  1. Rewrite your master with upstream’s master using git rebase:
  $ git rebase upstream/master
  1. Push your updates to master.
  $ git push origin master

You may need to force the push with:

  $ git push origin master --force

All done!

twitter logo DISCUSS
Classic DEV Post from Feb 10

What should you do after you fail the technical interview?

Asking for a friend, of course... But really. I'm not currently interviewing...

Serhat Teker profile image
Uomo Universale | Software Engineer | Entrepreneur | builds systems | py:js:go |