Skip to content
Andreas Schmittner edited this page Mar 5, 2021 · 36 revisions

Welcome to the UVic2.9 wiki! This version of the UVic climate model is used and developed by various groups around the world. More info about MOBI is available at the MOBI wiki.

Follow these steps to use git to download, use, modify and contribute. Steps 1-3 are only necessary the first time. This workflow is also described elsewhere.

  1. Create a fork on github
  1. Clone your fork onto your local machine. On the command line type:
  • git clone https://github.com/your_github_username/UVic2.9
  • cd UVic2.9

The following command shows the remote repository, which by default was given the name "origin"

  • git remote -v
  1. Add the main repository for exchange with your local server:
  • git remote add upstream https://github.com/OSU-CEOAS-Schmittner/UVic2.9

In git the main repository will now be known as “upstream”, in contrast to your fork on the server (“origin”).

  • git remote -v

Now shows you both remote repositories. If the main repository had been changed after you’ve forked from it, you could pull in those changes:

  • git pull upstream main
  1. Create a new branch
  • git checkout -b new-UVic-feature

This command does two things. It creates the branch "new-UVic-feature" and it switches to it. You can achieve the same with two separate commands: git branch new-UVic-feature and git checkout new-UVic-feature. You can use different branches. To see which branches there are use git branch. The main branch used to be called "master".

  1. Modify the code and commit your changes
  • edit the code in updates/latest
  • git commit -am "add super parameterization"

Here “add super parameterization” is a comment describing your changes. You can (and typically should) make many commits. To add a new file (e.g. updates/latest/source/sed/sed.F) do

  • git add updates/latest/source/sed/sed.F and commit again
  • git commit This will open the vim editor where you can add comments. Save and quit vim with "ZZ".

Once you’ve tested your code and think it is good to be merged to the main repository continue with the next step.

  1. Push your changes to github
  • git push origin new-UVic-feature

On github a new branch will show up in your fork with a green button saying, “Compare and pull request”.

  1. Initiate pull request by clicking on that button

This will show up on the main repository site and notify me through email. I can then merge it into the main repository. If you're done with working on the new branch and it has been merged you can delete it with git branch -d new-UVic-feature.

You're all done! Congratulations! And thank you for contributing!

More details about this work flow are described here: https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project. In particular you want to make sure your local repository is up-to-date with the main repository as described at the end of the previous URL. You can do this by changing to your local master branch:

  • git checkout master and then pulling in the master branch of the main repository:
  • git pull upstream master and push your local to your github fork:
  • git push origin master

Other useful git commands are git log and git status. Please only use /updates/latest to edit code. This will be our development branch. Once in a while it will be copied to a new numbered updates directory, e.g. 07.

To learn more about git and github have a look at this book https://git-scm.com/book especially the chapters on basics and branching.


Clone this wiki locally