GitHub: Creating an up-to-date branch that tracks main repository

This is written for the circumstances where a new release is published, and you want to work on the files contained in that new release.

This guide uses commands for linux terminal, a different OS will require different commands

In your browser, navigate to your github → the repository you are interested in.


You will want to work on a particular branch of that repository to make small changes to it without breaking the parent repository.

Do this by creating a clone of the branch you are interested in by using the branch drop-down, selecting it, then going into the same drop-down and starting to type the name of the new branch.

Note, the next stage assumes you have pulled your repositories onto your local machine already

Open Shell terminal.

Change directory to your github folder: (use ls to see where you currently are in the file system and where you can go)

1 2 3 4 alex@d2k-laptop-6:~$ ls Desktop Downloads Music Public snap Videos Documents examples.desktop Pictures R Templates 'VirtualBox VMs' alex@d2k-laptop-6:~$ cd Documents/2020\ DataSHIELD\ sources/

“2020\ DataSHIELD\ sources” happens to be my file name.

Next do a git clone, which is going to create a new directory you have just navigated to, and includes the contents of the branch you just made on the website.

1 git clone -b v6.0-dev_tableupdates dsBase_v6.0-dev

Which is in the structure: git commands; specific git commmand clone; website to look at; “-b” to create new branch; new branch name; new folder name.

ls will show the newly created contents of your datashield directory.

cd into this new directory.

Next you must add the upstream so you can refer to that with the git commands:

1 git remote add upstream

^ stuart, which website would this be referencing?

Next you would fetch information:

Stuart, what exactly IS fetching? Information from where to where?

1 git fetch --all

From here, you are set to start making edits you want on the files within this new working branch of the repository.

For information on how to update your branch with the edits made on someone else’s branch, click here.

DataSHIELD Wiki by DataSHIELD is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Based on a work at