Developing in the Hirlam GitHub organization
Introduction
Since 2018 and CY43 HIRLAM have used git for code revision control and gitolite as the git server on hirlam.org. HIRLAM is now moving to using Github for ''software development and version control''. This page provides information on how to access the GitHub Hirlam organisation and how to commit your developments, specifically Harmonie. As was the case with hirlam.org's gitolite a fork-and-branch workflow will be used to manage developments.
Becoming a member of Hirlam
- Create a GitHub account: https://github.com – click on Sign up. Details here
- Go to settings and add your full name, company and location to make it easier to identify you
- Add your public ssh key(s) to the account. Details here
- Contact your friendly System-core to be invited to the GitHub Hirlam organisation
Fork and branch
You can create a user fork of Harmonie by doing the following:
Click on Fork to create a fork of Harmonie for your user (USER)
Clone your fork:
git clone git@github.com:USER/Harmonie.git $HOME/git/github/USER/Harmonie
Further information is available here
Keep your fork synced
In a terminal change directory to the clone of you fork:
cd $HOME/git/github/USER/Harmonie
List the current configured remote repository for your fork.
git remote -v origin git@github.com:USER/Harmonie.git (fetch) origin git@github.com:USER/Harmonie.git (push)
Specify a new remote upstream repository that will be synced with the fork.
git remote add upstream git@github.com:Hirlam/Harmonie.git
Verify the new upstream repository you've specified for your fork.
git remote -v origin git@github.com:USER/Harmonie.git (fetch) origin git@github.com:USER/Harmonie.git (push) upstream git@github.com:Hirlam/Harmonie.git (fetch) upstream git@github.com:Hirlam/Harmonie.git (push)
Update the
dev-CY46h1
branch in your fork.git checkout dev-CY46h1 git pull upstream dev-CY46h1 git push origin dev-CY46h1
Further information is available here
An alternative approach is to go to your fork on github.com and click "Fetch upstream" which will sync the branch on GitHub followed by a git pull
in your clone
If you put the following in your .bashrc
it will show the name of the branch in your prompt (when inside a git repository)
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
NO_COLOR="\[\033[0m\]"
PS1="$GREEN\u@\h$NO_COLOR:\w$YELLOW\$(parse_git_branch)$NO_COLOR\$ "
Contributing developments – dev-CY46h1
Contributions to the dev-CY46h1
branch (and any other branch) should be developed in your Harmonie fork in a development branch (feature/bugfix/...). The following details how you can get your development upstream
.
Create a feature
branch
cd $HOME/git/github/USER/Harmonie
git checkout dev-CY46h1
git checkout -b feature/descriptive_name_for_developments
Keep up to date with dev-CY46h1
Sync your fork as described above
Merge
dev-CY46h1
updates in to your branchcd $HOME/git/github/USER/Harmonie git checkout feature/descriptive_name_for_developments git merge dev-CY46h1
Creating a pull request
Once you have committed to your feature branch and wanted them included in the upstream repo you should do the following:
Push your branch to your fork:
cd $HOME/git/github/USER/Harmonie git checkout feature/descriptive_name_for_developments git push origin feature/descriptive_name_for_developments
When you push your branch information on how to create a pull request will be presented:
remote: Resolving deltas: 100% (x/x), completed with x local objects. remote: remote: Create a pull request for 'feature/descriptive_name_for_developments' on GitHub by visiting: remote: https://github.com/USER/Harmonie/pull/new/feature/descriptive_name_for_developments remote:
Follow this link
- request a reviewer
- add labels to the development (feature/enhancement/...)
- add comments to help with the review process (Testbed members used/Changes expected if any/...)
Once the pull request has been approved by the System-core team it will be merged in to the
dev-CY46h1
branch
Further information is available here
Moving my branches from hirlam.org
Add your hirlam.org fork as a remote (HLUSER is your hirlam.org username)
cd $HOME/git/github/USER/Harmonie git remote add hirlamorgfork https://git.hirlam.org/users/HLUSER/Harmonie git fetch hirlamorgfork
For each branch BRANCHNAME you want to move to github
git checkout -t hirlamorgfork/BRANCHNAME git push origin BRANCHNAME
Useful git/github links
learn git branching is an excellent interactive tool to understand git.
Coding Standards
See Coding standards for Arpège, IFS and Aladin and Arpege/IFS Fortran coding standard (requires ECMWF account)