Wiki

Clone wiki

Unit Class Library / Obtaining and Submitting Code for Contribution

Fork and Pull Request Model

To safeguard the code, we use the fork and pull request model. This means that to contribute code to this project, you will fork the project. You'll have your own copy of the project for editing; instead of editing the code in the main repository. After making your changes/additions in the forked project, you will create a "pull request" to merge your work into the original Unit Class Library. Your code will be reviewed by project managers before it is merged. See also this explanation from BitBucket.

Since the project you are working on is forked, feel free to branch and experiment as much as necessary!

Obtaining and Submitting Code for Contribution

We use the Fork and Pull Request Model, described above, and our underlying source version control engine is Git. Browse a Git tutorial here. You will use Git commands (or concepts, at least) in contributing to this project.


Getting the Code

Forking Unit Class Library

From the menu on the left, select the option to fork this repository. This will copy the repository to your own set of repositories. This copied repository is the one you will work within until you are ready to submit your code.

Getting the Code Locally

Once you've forked the repository, you can load it onto your local machine.To work with the code from a repository, you need to clone it to your workspace. This means that you are making a copy of the code from the repository onto your local machine. The command will follow this structure:

$ git clone <repository_url>


Submitting the Code

Getting our Updates

When you submit your code we want the only differences between your code and our code to be the changes you have made in completing your task. Therefore, before creating a pull request, you'll need to pull our updates into your code. We recommend you do this by creating a second remote location that is our repository. You can do that with this command (you need only do this once):

$ git remote add <name for remote, perhaps clearspanorigin> https://@bitbucket.org/Clearspan/unit-class-library.git
Now you can pull (but not push, our repository is read-only for you) from our repository, making sure you can integrate our latest updates. Pull from our remote branch with this command:
$ git pull <name for remote specified above> develop
Merge any conflicts as necessary. Depending on the duration of your task, it may be wise to pull our updates from our repository throughout the course of your task rather than all at once, therefore preventing errors and merge conflicts. To do so, use the command above.

Additionally, please build it before you generate the pull request. While our updates may not generate merge conflicts, they may cause something not to build (we may have renamed something for example).

Push Modified Code to your Repository

Once your code is ready and has integrated all our updates, you can commit and push it to your forked project.

  1. Add your code: $ git add --all
  2. Commit your code: $ git commit -m "<message describing your work>"
  3. Push your code: $ git push

Create a Pull Request

Now your code should be up to date in your forked repository. Navigate to your forked repository and click "Create Pull Request". Check that the options are correct and describe your work. Your code will be submitted to be reviewed by the Unit Class Library managers. Thank you!

Updated