Synchronize your fork github repository

How to synchronize your fork github repository?

It is possible to synchronize your fork from the github interface but we recommend to follow the steps from the command line.

Step-1: Clone your fork

  • Open a terminal in Jupyterhub
  • Then clone your fork e.g. make sure you replace USERNAME by your github username
git clone NEGI-Abisko-2019-fork

The command above makes a copy of your online fork NEGI-Abisko-2019 repository and store it in a folder locally. We named this folder NEGI-Abisko-2019-fork so we remember it is our fork and not the main NordicESMHub repository.

Then change directory to your fork:

cd NEGI-Abisko-2019-fork

Your local NEGI-Abisko-2019-fork is linked to your github repository but NOT to NordicESMHub.

How do we know that?

git remote -v

It should return something like (with your github username, instead of USERNAME):

origin (fetch)
origin (push)

So let's do it now:

git remote add upstream

The name upstream is arbitrary and can be changed with any other name of your choice. You then need to use it instead of upstream.

We can check it:

git remote -v

And now we have two new lines.

origin (fetch)
origin (push)
upstream (fetch)
upstream (push)

Step-3: update your local repository

git pull upstream master

The command above updated your local fork (on jupyterhub).

In case a merge happens, a window will pop pup and ask you to merge. By default, we have emacs editor in git so use F10 --> Save and F10 --> exit.

Step-4: push your local changes to github

Our fork is now up to date locally on Jupyterhub but still not yet updated online on github. So now we need to push our changes on github:

git push origin master

You are now ready to update your local repository and add new contributions!

**Whenever you need to make new contribution, the best is to update your fork before.