This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Process for contributing to nRF Connect SDK?

Hi,

Every now and then we have to fix bugs in nRF Connect SDK. Some of the bug fixes are of general interest. What is the process for contributing fixes to Github?

BR / Björn

  • Hi Björn,"
    This guide is largely based on the documentation "Contribution Guidelines for the Zephyr repo",
    but I've made some small changes so that it fits the manifest repo "nrf" (fw-nrfconnect-nrf):

    Contribution Workflow:
    1Create a Fork of the NRF repo to your personal account on GitHub. (Click on the fork button in the top right corner of the nRF Connect repo page in GitHub.)

    2. On your development computer, change into the nrf folder that was created when you obtained the code (cloned your fork): 

    cd ncs/nrf

    Rename the default remote pointing to the upstream repository from origin to upstream

    git remote rename origin upstream

    Let Git know about the fork you just created, naming it origin

    git remote add origin https://github.com/<your github id>/fw-nrfconnect-nrf

    and verify the remote repos:

    git remote -v

    The output should look similar to:
    origin   https://github.com/<your github id>/fw-nrfconnect-nrf (fetch)
    origin   https://github.com/<your github id>/fw-nrfconnect-nrf (push)
    upstream https://github.com/NordicPlayground/fw-nrfconnect-nrf (fetch)
    upstream https://github.com/NordicPlayground/fw-nrfconnect-nrf (push)


    3. Create a topic branch (off of master) for your work (if you’re addressing an issue, we suggest including the issue number in the branch name):

    git checkout master
    git checkout -b fix_comment_typo



    4. Make changes in files, test locally, change, test, test again, … (Check out the prior chapter on sanitycheck as well).

    5. When things look good, start the pull request process by adding your changed files:

    git add [file(s) that changed, add -p if you want to be more specific]

    You can see files that are not yet staged using:
    git status

    6. Verify changes to be committed look as you expected:

    git diff --cached

    7. Commit your changes to your local repo (see commit guidelines):

    git commit -s

    The -s option automatically adds your Signed-off-by: to your commit message. (Your commit will be rejected without this line that indicates your agreement with the DCO. See the Commit Guidelines section for specific guidelines for writing your commit messages).

    8. Push your topic branch with your changes to your fork in your personal GitHub account:

    git push origin fix_comment_typo

    9. In your web browser, go to your forked repo and click on the Compare & pull request button for the branch you just worked on and you want to open a pull request with.

    10. Review the pull request changes, and verify that you are opening a pull request for the appropriate branch. The title and message from your commit message should appear as well.
    tip: Make sure you are following a similar structure as other pull requests

    11. Click on the "Create pull request" button and your pull request is sent and awaits review. Email will be sent as review comments are made, or you can check on your pull request at: https://github.com/NordicPlayground/fw-nrfconnect-nrf/pulls

    12. While you’re waiting for your pull request to be accepted and merged, you can create another branch to work on another issue.

    Be sure to make your new branch off of master and not the previous branch.:

    git checkout master
    git checkout -b fix_another_issue

    and use the same process described above to work on this new topic branch.

    13. If reviewers do request changes to your patch, you can make changes to your local repo and push the new changes.

    In your development repo after you made your changes:

    git add [file(s)]

    Update the commit content if needed,

    git commit --amend

    and continue:

    git push --force origin fix_comment_typo

    By force pushing your update, your original pull request will be updated with your changes so you won’t need to resubmit the pull request.

    14. If the CI run fails, you will need to make changes to your code in order to fix the issues and amend your commits by rebasing as described above. Additional information about the CI system can be found in Continuous Integration.


    Best regards,

    Martin L.

Related