How to sync a fork

25 February 2018 · 2 minutes to read

1. Introduction

So, you forked a repo, started working on it (or just forgot it there because you also had other stuff to take care of 😂😂️). The parent fork continued evolving and you ended up at point where you want to also update your fork with the last HEAD of the parent,

2. Use Case

Next month Utrecht Java User Group hosts…one of its co-organizers :bowtie: , Sendil Kumar N, who’s gonna give a talk about JHipster, so, I thought about taking a look at it, before the meetup, in order to educate myself a bit. However, after some time I ended up playing with its Kotlin porting, which is still a WIP (for the ones who are interested in contributing :smiley:

The latter implies that it is often updated, so locally, today I still had this in my HEAD:


Whereas, remotely, this was the latest update of the day:


So, my fork was behind .

How could I easily update it according to the latest HEAD of the parent?

3. Solution

First, check your local’s remote references:


Ok, it only contains my fork, so, I have to also add the parent as an upstream:

$ git remote add upstream

Let’s confirm it was added:


Time for magic!!!


4. References

5. Closing quote

The more you practice, the easier it becomes.