Skip to content

Creating and forking projects

Andrew Post edited this page May 8, 2017 · 8 revisions

We use GitHub for version control and code reviews for all Eureka! Clinical projects. Our workflow is to have one central, upstream repository, which consists of a stable version of the code, and individual developer forks, which are used for developing new features until they are ready. The upstream repositories are in the https://github.com/eurekaclinical organization. The developer forks are in each developer's own GitHub account. This page provides instructions for creating projects and forking them.

Forking an existing Git repository

Most commonly, you will want to fork an existing Eureka! Clinical repository, which can either be the upstream copy or another developer's. On GitHub, this is simple:

  • Go to the upstream repository main page
  • Click 'Fork' on the upper-right-hand side of the screen.

This will create a copy of the repository in your personal GitHub account. Now, the developer can clone the original repo as upstream, and set the local copy as origin:

# Back on user's local machine
$ git clone https://github.com/eurekaclinical/project
...
$ cd project
$ git remote add origin https://github.com/user/project.git
$ git remote -v
origin    https://github.com/user/project.git (fetch)
origin    https://github.com/user/project.git (push)

Finally, the developer can add the upstream remote, or any others:

$ git remote add upstream https://github.com/eurekaclinical/project.git
$ git remote -v
origin    https://github.com/user/project.git (fetch)
origin    https://github.com/user/project.git (push)
upstream    https://github.com/eurekaclinical/project.git (fetch)
upstream    https://github.com/eurekaclinical/project.git (push)

Then, push the local master branch to upstream as follows:

$ git push -v --tags --set-upstream upstream refs/heads/master:refs/heads/master

Now that you have an upstream master branch, create a tracking branch to make using it easier:

$ git branch --track upstream-master upstream/master

Now, you can push to upstream/master from upstream-master with:

git push upstream upstream-master:master

Creating a new Git repository

First, click 'New' on the Eureka! Clinical organization main page, and enter the required fields to create a new repository. Once completed, GitHub will present the URLs for accessing the new repository. You can do the same from your own GitHub account profile to create a new repository in your own account.

You can add the upstream repository as a remote from your local machine, and then perform the initial push to it:

# On local machine
$ cd /path/to/local/project
$ git remote add upstream https://github.com/eurekaclinical/project.git
$ git branch --track upstream-master upstream/master
$ git push upstream --all
$ git push upstream --tags

Now, you can create your origin repository by forking the upstream repository as described above.

Clone this wiki locally