Skip to content

Contributing to the project

Waldir Leoncio edited this page Feb 4, 2021 · 4 revisions

Using Git to contribute code

Summary

  1. Create you own fork of the project
  2. Clone the fork to your local computer
  3. Add the upstream repository (ocbe-uio) as a second remote source on your local repository
  4. Pull from the upstream repository
  5. Do some actual work
  6. Push to your fork (because you supposedly cannot write to the upstream repo)
  7. Open a Pull Request to push the changes on your fork to the upstream repo

Forking the main project

In order to contribute code to TruncExpFam, please create a fork of this repository (instructions here).

Once you're setup (i.e., you have cloned your fork to you working computer), you can follow the suggested workflow below to merge your contribution to the main repository. The next step is to add the upstream (ocbe-uio) repository to your remotes list so you can pull it from there

Adding the upstream repository as a remote

The previous step should have you setup in a way that, from the working directory, you can type git remote and see your fork of the repository (it's probably named "origin", though you can use more meaningful names such as "myfork").

From your local terminal, please add ocbe-uio as another remote:

git remote add ocbe-uio git@github.com:ocbe-uio/TruncExpFam.git

If git@github.com:ocbe-uio/TruncExpFam.git doesn't work, you need to configure your GitHub account to allow SSH access. Instructions on doing so can be found here. Alternatively, you can try using the HTTPS address of the repository (https://github.com/ocbe-uio/TruncExpFam.git), though HTTPS access is being phased out and may not work.

After doing this, you should be able to see two entries on git remote: your fork and ocbe-uio.

Sample Git workflow

With the above set up, you can finally start doing some coding! Here's a suggestion of a workflow between your local terminal and your fork.

git fetch  # makes sure your repository sees the latest version of the remotes
git pull # syncs the content of your local checked-out branch with your fork
git pull ocbe-uio develop # syncs the content of your local develop branch with ocbe-uio/develop
# make changes to the relevant files in the file editor of your preference
git add -A # stages all changed files to be committed
git commit -m "Fixes Issue #100" # commit changes with a message
git push # sync the changes back to your fork (not ocbe-uio)

You can often use git status and git log in between those commands to make sure the files are really moving to the places you intend them to.

After your fork is updated, go to its homepage and there should be a button for issuing a pull request.

References

The sample workflow above is based on GitFlow, a workflow model for Git which is well-worth a read!

To make the process faster, we recommend using GitHub CLI to fork and create Pull Requests straight from the command line.

Contributing with ideas and comments

All contributions to the package are welcome! Please open an issue by clicking here and describe the bug you found, an idea you had... any observation that you think might improve the package.