# Get the source code

## Create a fork

Go to the official OGS-6 repository and click the “Fork”-button. This creates a new fork under your account with the URL https://github.com/YOUR-USERNAME/ogs.

You can use the git command line tool to clone the remote repository on GitHub to your PC:

$git clone https://github.com/YOUR-USERNAME/ogs$ cd ogs
$git config remote.pushdefault origin$ git config push.default current

This creates a new folder ogs in your current working directory with the OGS source code. After this step, the remote called origin refers to your fork on GitHub. It also sets the default remote for pushes to be origin and the default push behavior to current. Together this means that if you just type git push, the current branch is pushed to the origin remote (git version >= 2.5 required).

Create a second remote called upstream that points at the main OGS repository and fetch from it:

$git remote add upstream https://github.com/ufz/ogs$ git fetch upstream

## Optional: Working on a new feature

You only have to follow the above steps once. From then on, whenever you want to work on a new feature, you can more easily interact with the remote repositories.

Make sure that your local repository is up-to-date with the upstream repository:

$git fetch upstream Create a branch feature-name off of upstream master-branch to work on a new feature, and check out the branch: git checkout -b feature-name upstream/master This automatically sets up your local new-feature-branch to track the upstream master-branch. This means that if more commits are added to master upstream, you can merge those commits into your feature-branch by typing $ git pull

or rebase your branch on top of the new master by typing

$git pull --rebase Now after you implemented the feature and committed your work you can push the new commits to the feature-name-branch on your GitHub fork: $ git push

If your work is done submit a pull request.

This workflow is summarized with this picture:

Previous

This article was written by Lars Bilke. If you are missing something or you find an error please let us know. Generated with Hugo 0.54.0. Last revision: May 29, 2019
Commit: [web] Added some screen recordings for clone, config, build and tests. 166c42b97  | Edit this page on