Lately my friend ask me: „I’ve forked repository from, how can I update it?”. I’ll write an answer for this question here.


As example I’ll use Kotlin Language repository from (I like Kotlin and I’m proud of it :))

First we clone repository:

marioosh is my github’s username use your own in this place. Don’t forget to fork the repository you are interested in.

Upstream tracking

Now it’s time to set up upstream branch. This branch point to original repository you’ve forked from.

In the repository should be now 2 branches:


Sync process needs two steps – fetching and merging. Fetch from remote repository will bring in commits, that are stored in your local repository.

To finish syncing process we have to merge upstream into our master branch.