4.1. Introduction to Working with the HAFS Repository in GitHub

(Please see the Prerequisites for Working with the HAFS Repository before beginning.)

General steps to add new developments to the HAFS GitHub repository:

  1. Fork the HAFS repository and clone the forked repository locally.

  2. Create a feature branch from the develop branch to add new developments.

    1. Add developments.

    2. Complete testing.

    3. Commit changes into the local branch and push the local branch to your personal fork.

  3. Submit a Pull Request (PR) to request a code review and merge new developments with the authoritative HAFS repository.

4.1.1. Fork the HAFS Repository and Clone the Forked Repository Locally

Users need a GitHub account to work with the HAFS repository. Instructions for creating an account are available on GitHub and via the Earth Prediction Innovation Center website.

  1. Navigate to https://github.com/hafs-community/HAFS. Locate and click on the “fork” button towards the top right of the page. Users can create a fork by selecting the default settings; more advanced users may opt to alter the defaults.

    Yellow box highlights the "fork" button toward the top right of the page.
  2. Clone the newly created HAFS fork, which will copy the repository onto the user’s local system.

    git clone --recursive https://USERNAME@github.com/USERNAME/HAFS.git
    

    Users should replace USERNAME with their GitHub username in the command above.

4.1.2. Create a Feature Branch from the develop Branch

  1. Check out the develop branch:

    git checkout develop
    
  2. Create a new branch from the develop branch:

    git checkout -b feature/mybranch
    
  3. Update the submodules:

    If there are changes for the URLs of the submodules, run this command to update the remote versions of the submodules

    git submodule sync --recursive
    

    Note: every time after you clone a git repository or check out a new branch, if submodule changes are expected, you need to update the submodules properly by

    git submodule update --init --recursive
    
  4. Make modifications and commit changes locally:

    vi NewCodeFile
    git add NewCodeFile
    git commit -m “Add newcode description”
    
  5. Push changes to your GitHub HAFS fork:

    git push origin feature/mybranch
    

4.1.3. Submit a Pull Request for Inclusion into the Authoritative HAFS Repository

To propose changes for inclusion into the authoritative HAFS repository, developers need to create a pull request.

  1. Navigate to pulls and click on New pull request.

  2. Click on Compare across forks. a. Set the base repository to hafs-community/HAFS and the base branch to develop. b. Set the head repository to YOUR_GITHUB_USERNAME/HAFS and the compare branch to feature/mybranch.

  3. Add a descriptive title and short description in the text boxes describing the changes.

  4. Click on Create pull request.