Git Merge from Upstream Fork

If you created your asclinic-system repository as a fork of:

https://gitlab.unimelb.edu.au/asclinic/asclinic-system.git

then it will be beneficial to occasionally synchronise, i.e., merge, changes from that “original” repository into your fork. To understand the descriptions below, the key terminology is that the “original” asclinic-system repository that you forked is referred to as the “upstream” repository.

This repository mirroring entry in the GitLab documentation, and the links therein, provide a description for how to synchronise changes via the website.

Alternatively, you can synchronise changes by the following command line commands.

Add the upstream remote

  1. Your repository needs to be configured to have the upstream repository as a so-called remote. Add the upstream repository using the command:

git remote add upstream <url-to-upstream-remote>

If you forked from the repository linked at the top of this page, then the full command is:

git remote add upstream https://gitlab.unimelb.edu.au/asclinic/asclinic-system.git
  1. Verify that step 1 worked by observing the output displayed by the command:

git remote -v

The output displayed should be something like:

origin    https://gitlab.unimelb.edu.au/pbeuchat/asclinic-system.git (fetch)
origin    https://gitlab.unimelb.edu.au/pbeuchat/asclinic-system.git (push)
upstream  https://gitlab.unimelb.edu.au/asclinic/asclinic-system.git (fetch)
upstream  https://gitlab.unimelb.edu.au/asclinic/asclinic-system.git (push)

Note that these two steps above only need to be performed once for the repository.

Merge in changes from the upstream remote

  1. Fetch changes from the upstream repository using the command:

git fetch upstream
  1. Checkout the master, i.e., switch to the master branch of your local repository:

git checkout master
  1. Merge the changes from the master branch of the upstream repository, i.e., from upstream/master, into the master branch of your local repository:

git merge upstream/master

If there are merge conflicts, these will need to be handled in the usual fashion.