| <!-- |
| Documentation/_templates/layout.html |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. The |
| ASF licenses this file to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance with the |
| License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| License for the specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| |
| |
| <!DOCTYPE html> |
| <html class="writer-html5" lang="en"> |
| <head> |
| <meta charset="utf-8" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> |
| |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| <title>Making Changes Using Git — NuttX latest documentation</title> |
| <link rel="stylesheet" type="text/css" href="../_static/pygments.css" /> |
| <link rel="stylesheet" type="text/css" href="../_static/css/theme.css" /> |
| <link rel="stylesheet" type="text/css" href="../_static/copybutton.css" /> |
| <link rel="stylesheet" type="text/css" href="../_static/custom.css" /> |
| |
| |
| <link rel="shortcut icon" href="../_static/favicon.ico"/> |
| <script src="../_static/jquery.js"></script> |
| <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script> |
| <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> |
| <script src="../_static/doctools.js"></script> |
| <script src="../_static/sphinx_highlight.js"></script> |
| <script src="../_static/clipboard.min.js"></script> |
| <script src="../_static/copybutton.js"></script> |
| <script src="../_static/js/theme.js"></script> |
| <link rel="index" title="Index" href="../genindex.html" /> |
| <link rel="search" title="Search" href="../search.html" /> |
| <link rel="next" title="C Coding Standard" href="coding_style.html" /> |
| <link rel="prev" title="Development Workflow" href="workflow.html" /> |
| </head> |
| |
| <body class="wy-body-for-nav"> |
| <div class="wy-grid-for-nav"> |
| <nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
| <div class="wy-side-scroll"> |
| <div class="wy-side-nav-search" > |
| |
| <a href="../index.html" class="icon icon-home"> NuttX |
| |
| |
| |
| </a> |
| |
| <!-- this version selector is quite ugly, should be probably replaced by something |
| more modern --> |
| |
| <div class="version-selector"> |
| <select onchange="javascript:location.href = this.value;"> |
| |
| <option value="../../latest" selected="selected">latest</option> |
| |
| <option value="../../10.0.0" >10.0.0</option> |
| |
| <option value="../../10.0.1" >10.0.1</option> |
| |
| <option value="../../10.1.0" >10.1.0</option> |
| |
| <option value="../../10.2.0" >10.2.0</option> |
| |
| <option value="../../10.3.0" >10.3.0</option> |
| |
| <option value="../../11.0.0" >11.0.0</option> |
| |
| <option value="../../12.0.0" >12.0.0</option> |
| |
| <option value="../../12.1.0" >12.1.0</option> |
| |
| <option value="../../12.2.0" >12.2.0</option> |
| |
| <option value="../../12.2.1" >12.2.1</option> |
| |
| <option value="../../12.3.0" >12.3.0</option> |
| |
| <option value="../../12.4.0" >12.4.0</option> |
| |
| <option value="../../12.5.0" >12.5.0</option> |
| |
| <option value="../../12.5.1" >12.5.1</option> |
| |
| <option value="../../12.6.0" >12.6.0</option> |
| |
| <option value="../../12.7.0" >12.7.0</option> |
| |
| <option value="../../12.8.0" >12.8.0</option> |
| |
| <option value="../../12.9.0" >12.9.0</option> |
| |
| <option value="../../12.10.0" >12.10.0</option> |
| |
| <option value="../../12.11.0" >12.11.0</option> |
| |
| </select> |
| </div> |
| |
| |
| <div role="search"> |
| <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> |
| <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" /> |
| <input type="hidden" name="check_keywords" value="yes" /> |
| <input type="hidden" name="area" value="default" /> |
| </form> |
| </div> |
| |
| </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> |
| <p class="caption" role="heading"><span class="caption-text">Table of Contents</span></p> |
| <ul class="current"> |
| <li class="toctree-l1"><a class="reference internal" href="../index.html">Home</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../introduction/index.html">Introduction</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../quickstart/index.html">Getting Started</a></li> |
| <li class="toctree-l1 current"><a class="reference internal" href="index.html">Contributing</a><ul class="current"> |
| <li class="toctree-l2"><a class="reference internal" href="workflow.html">Development Workflow</a></li> |
| <li class="toctree-l2 current"><a class="current reference internal" href="#">Making Changes Using Git</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="#git-workflow-with-an-upstream-repository">Git Workflow With an Upstream Repository</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#submitting-your-changes-to-nuttx">Submitting Your Changes to NuttX</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#how-to-include-the-suggestions-on-your-pull-request">How to Include the Suggestions on Your Pull Request?</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#git-resources">Git Resources</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="coding_style.html">C Coding Standard</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="documentation.html">Documentation</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="releases.html">Creating an Apache NuttX Release</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../introduction/inviolables.html">The Inviolable Principles of NuttX</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../platforms/index.html">Supported Platforms</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../components/index.html">OS Components</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../applications/index.html">Applications</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../implementation/index.html">Implementation Details</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../reference/index.html">API Reference</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../faq/index.html">FAQ</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../guides/index.html">Guides</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../logos/index.html">NuttX Logos</a></li> |
| </ul> |
| |
| </div> |
| </div> |
| </nav> |
| |
| <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > |
| <i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
| <a href="../index.html">NuttX</a> |
| </nav> |
| |
| <div class="wy-nav-content"> |
| <div class="rst-content"> |
| <div role="navigation" aria-label="Page navigation"> |
| <ul class="wy-breadcrumbs"> |
| <li><a href="../index.html" class="icon icon-home" aria-label="Home"></a></li> |
| <li class="breadcrumb-item"><a href="index.html">Contributing</a></li> |
| <li class="breadcrumb-item active">Making Changes Using Git</li> |
| <li class="wy-breadcrumbs-aside"> |
| <a href="../_sources/contributing/making-changes.rst.txt" rel="nofollow"> View page source</a> |
| </li> |
| </ul> |
| <hr/> |
| </div> |
| <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> |
| <div itemprop="articleBody"> |
| |
| <section id="making-changes-using-git"> |
| <span id="making-changes"></span><h1>Making Changes Using Git<a class="headerlink" href="#making-changes-using-git" title="Permalink to this heading"></a></h1> |
| <p>The Apache NuttX project uses the <a class="reference external" href="https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control">Git version control system</a> |
| to track changes, and the source code is hosted on <a class="reference external" href="https://www.github.com">GitHub</a>.</p> |
| <p>If you want to make changes to NuttX, for your own personal use, or to submit them back to project to improve NuttX, |
| that’s easy. For the purposes of this guide, you’ll need a <a class="reference external" href="https://www.github.com">GitHub</a> account, since |
| the Apache NuttX team uses GitHub. (You could also use git locally, or save your changes to other sites like |
| <a class="reference external" href="https://about.gitlab.com/">GitLab</a> or <a class="reference external" href="https://bitbucket.org">BitBucket</a>, but that’s beyond the scope of this |
| guide).</p> |
| <p>Here’s how to do it:</p> |
| <ol class="arabic"> |
| <li><p>Set your git user name and email</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span><span class="nb">cd</span><span class="w"> </span>nuttx/ |
| $<span class="w"> </span>git<span class="w"> </span>config<span class="w"> </span>--global<span class="w"> </span>user.name<span class="w"> </span><span class="s2">"Your Name"</span> |
| $<span class="w"> </span>git<span class="w"> </span>config<span class="w"> </span>--global<span class="w"> </span>user.email<span class="w"> </span><span class="s2">"yourname@somedomaincom"</span> |
| </pre></div> |
| </div> |
| </div></blockquote> |
| </li> |
| <li><p>Sign in to GitHub</p> |
| <p>If you don’t have a <a class="reference external" href="https://www.github.com">GitHub</a> account, it’s free to |
| sign up.</p> |
| </li> |
| <li><p>Fork the Projects</p> |
| <p>Visit both these links and hit the Fork button in the upper right of the page:</p> |
| <ul class="simple"> |
| <li><p><a class="reference external" href="https://github.com/apache/nuttx/">NuttX</a></p></li> |
| <li><p><a class="reference external" href="https://github.com/apache/nuttx-apps/">NuttX Apps</a></p></li> |
| </ul> |
| </li> |
| <li><p>Clone the Repositories</p> |
| <p>On the GitHub web page for your forked <code class="docutils literal notranslate"><span class="pre">nuttx</span></code> project, copy the clone url – get it by hitting the |
| green <code class="docutils literal notranslate"><span class="pre">Clone</span> <span class="pre">or</span> <span class="pre">Download</span></code> button in the upper right. Then do this:</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>clone<span class="w"> </span><your<span class="w"> </span>forked<span class="w"> </span>nuttx<span class="w"> </span>project<span class="w"> </span>clone<span class="w"> </span>url><span class="w"> </span>nuttx |
| $<span class="w"> </span><span class="nb">cd</span><span class="w"> </span>nuttx |
| $<span class="w"> </span>git<span class="w"> </span>remote<span class="w"> </span>add<span class="w"> </span>upstream<span class="w"> </span>https://github.com/apache/nuttx.git |
| </pre></div> |
| </div> |
| </div></blockquote> |
| <p>Do the same for your forked <code class="docutils literal notranslate"><span class="pre">nuttx-apps</span></code> project:</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span><span class="nb">cd</span><span class="w"> </span>.. |
| $<span class="w"> </span>git<span class="w"> </span>clone<span class="w"> </span><your<span class="w"> </span>forked<span class="w"> </span>nuttx-apps<span class="w"> </span>project<span class="w"> </span>clone<span class="w"> </span>url><span class="w"> </span>apps |
| $<span class="w"> </span><span class="nb">cd</span><span class="w"> </span>apps |
| $<span class="w"> </span>git<span class="w"> </span>remote<span class="w"> </span>add<span class="w"> </span>upstream<span class="w"> </span>https://github.com/apache/nuttx-apps.git |
| </pre></div> |
| </div> |
| </div></blockquote> |
| </li> |
| <li><p>Create a Local Git Branch</p> |
| <p>Now you can create local git branches and push them to GitHub:</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>checkout<span class="w"> </span>-b<span class="w"> </span>test/my-new-branch |
| $<span class="w"> </span>git<span class="w"> </span>push |
| </pre></div> |
| </div> |
| </div></blockquote> |
| </li> |
| </ol> |
| <section id="git-workflow-with-an-upstream-repository"> |
| <h2>Git Workflow With an Upstream Repository<a class="headerlink" href="#git-workflow-with-an-upstream-repository" title="Permalink to this heading"></a></h2> |
| <p>The main NuttX git repository is called an “upstream” repository - this is because it’s the main source of truth, and |
| its changes flow downstream to people who’ve forked that repository, like us.</p> |
| <p>Working with an upstream repo is a bit more complex, but it’s worth it since you can submit fixes and features |
| to the main NuttX repos. One of the things you need to do regularly is keep your local repo in sync |
| with the upstream. I work with a local branch, make changes, pull new software from the upstream and merge it in, |
| maybe doing that several times. Then when everything works, I get my branch ready to do a Pull Request. Here’s how:</p> |
| <ol class="arabic"> |
| <li><p>Fetch upstream changes and merge into my local master:</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>checkout<span class="w"> </span>master |
| $<span class="w"> </span>git<span class="w"> </span>fetch<span class="w"> </span>upstream |
| $<span class="w"> </span>git<span class="w"> </span>merge<span class="w"> </span>upstream/master |
| $<span class="w"> </span>git<span class="w"> </span>push |
| </pre></div> |
| </div> |
| </div></blockquote> |
| </li> |
| <li><p>Merge my local master with my local branch:</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>checkout<span class="w"> </span>my-local-branch |
| $<span class="w"> </span>git<span class="w"> </span>merge<span class="w"> </span>master |
| $<span class="w"> </span>git<span class="w"> </span>push |
| </pre></div> |
| </div> |
| </div></blockquote> |
| </li> |
| <li><p>Make changes and push them to my fork</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>vim<span class="w"> </span>my-file.c |
| $<span class="w"> </span>git<span class="w"> </span>add<span class="w"> </span>my-file.c |
| $<span class="w"> </span>git<span class="w"> </span>commit<span class="w"> </span>my-file.c |
| $<span class="w"> </span>git<span class="w"> </span>push |
| </pre></div> |
| </div> |
| </div></blockquote> |
| </li> |
| <li><p>Repeat 1-3 as necessary</p></li> |
| <li><p>Run the <code class="docutils literal notranslate"><span class="pre">tools/checkpatch.sh</span></code> script on your files</p> |
| <p>When your code runs, then you’re almost ready to submit it. But first you need to check the code to ensure |
| that it conforms to the NuttX <a class="reference internal" href="coding_style.html#c-coding-standard"><span class="std std-ref">C Coding Standard</span></a>. |
| The <code class="docutils literal notranslate"><span class="pre">tools/checkpatch.sh</span></code> script will do that. Here’s the usage info:</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>./tools/checkpatch.sh<span class="w"> </span>-h |
| USAGE:<span class="w"> </span>./tools/checkpatch.sh<span class="w"> </span><span class="o">[</span>options<span class="o">]</span><span class="w"> </span><span class="o">[</span>list<span class="p">|</span>-<span class="o">]</span> |
| |
| Options: |
| -h |
| -c<span class="w"> </span>spell<span class="w"> </span>check<span class="w"> </span>with<span class="w"> </span>codespell<span class="o">(</span>install<span class="w"> </span>with:<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>codespell |
| -r<span class="w"> </span>range<span class="w"> </span>check<span class="w"> </span>only<span class="w"> </span><span class="o">(</span>used<span class="w"> </span>with<span class="w"> </span>-p<span class="w"> </span>and<span class="w"> </span>-g<span class="o">)</span> |
| -p<span class="w"> </span><patch<span class="w"> </span>list><span class="w"> </span><span class="o">(</span>default<span class="o">)</span> |
| -g<span class="w"> </span><commit<span class="w"> </span>list> |
| -f<span class="w"> </span><file<span class="w"> </span>list> |
| -<span class="w"> </span><span class="nb">read</span><span class="w"> </span>standard<span class="w"> </span>input<span class="w"> </span>mainly<span class="w"> </span>used<span class="w"> </span>by<span class="w"> </span>git<span class="w"> </span>pre-commit<span class="w"> </span>hook<span class="w"> </span>as<span class="w"> </span>below: |
| <span class="w"> </span>git<span class="w"> </span>diff<span class="w"> </span>--cached<span class="w"> </span><span class="p">|</span><span class="w"> </span>./tools/checkpatch.sh<span class="w"> </span>- |
| </pre></div> |
| </div> |
| </div></blockquote> |
| <p>Run it against your files and correct all the errors in the code you added, so that |
| <code class="docutils literal notranslate"><span class="pre">tools/checkpatch.sh</span></code> reports no errors. Then commit the result. |
| For example:</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>./tools/checkpatch.sh<span class="w"> </span>-f<span class="w"> </span>my-file.c |
| arch/arm/src/sama5/hardware/my-file.c:876:82:<span class="w"> </span>warning:<span class="w"> </span>Long<span class="w"> </span>line<span class="w"> </span>found |
| $<span class="w"> </span><span class="c1"># fix errors</span> |
| $<span class="w"> </span>vim<span class="w"> </span>my-file.c |
| $<span class="w"> </span><span class="c1"># run again</span> |
| $<span class="w"> </span>./tools/checkpatch.sh<span class="w"> </span>-f<span class="w"> </span>my-file.c |
| </pre></div> |
| </div> |
| </div></blockquote> |
| <p>If you have made a lot of changes, you can also use this bash commandline to see the errors for all the changed C |
| files in your branch (assumes you are currently on the branch that has the changed files):</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>diff<span class="w"> </span>--name-only<span class="w"> </span>master<span class="w"> </span><span class="p">|</span><span class="w"> </span>egrep<span class="w"> </span><span class="s2">"\.c|\.h"</span><span class="w"> </span><span class="p">|</span><span class="w"> </span>xargs<span class="w"> </span><span class="nb">echo</span><span class="w"> </span><span class="p">|</span><span class="w"> </span>xargs<span class="w"> </span>./tools/checkpatch.sh<span class="w"> </span>-f<span class="w"> </span><span class="p">|</span><span class="w"> </span>less |
| </pre></div> |
| </div> |
| </div></blockquote> |
| <p>Note that there are some bugs in the <code class="docutils literal notranslate"><span class="pre">nxstyle</span></code> program that <code class="docutils literal notranslate"><span class="pre">checkpatch.sh</span></code> uses, so |
| it may report a few errors that are not actually errors. The committers will help you |
| find these. (Or view the |
| <a class="reference external" href="https://github.com/apache/nuttx/issues?q=is%3Aissue+is%3Aopen+nxstyle">nxstyle Issues</a>.) |
| <br/> |
| <br/></p> |
| </li> |
| <li><p>Commit the fixed files</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>add<span class="w"> </span>my-file.c |
| $<span class="w"> </span>git<span class="w"> </span>commit<span class="w"> </span>my-file.c |
| $<span class="w"> </span>git<span class="w"> </span>push |
| </pre></div> |
| </div> |
| </div></blockquote> |
| </li> |
| </ol> |
| </section> |
| <section id="submitting-your-changes-to-nuttx"> |
| <h2>Submitting Your Changes to NuttX<a class="headerlink" href="#submitting-your-changes-to-nuttx" title="Permalink to this heading"></a></h2> |
| <blockquote> |
| <div><p>Pull requests let you tell others about changes you’ve pushed to a branch in a repository on GitHub. Once a pull |
| request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits |
| before your changes are merged into the base branch.</p> |
| <p>(from GitHub’s <a class="reference external" href="https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests">About pull requests</a> page)</p> |
| </div></blockquote> |
| <p>Before you do a Pull Request, the NuttX team will usually want all the changes you made in your branch “squashed” into |
| a single commit, so that when they review your changes, there’s a clean view of the history. If there are changes |
| after Pull Request review feedback, they can be separate commits. Here’s the easiest way I found to do that initial |
| squash before submitting the Pull Request:</p> |
| <ol class="arabic"> |
| <li><p>Check out my branch</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>checkout<span class="w"> </span>my-branch |
| </pre></div> |
| </div> |
| </div></blockquote> |
| </li> |
| <li><p>Fetch the upstream code</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>fetch<span class="w"> </span>upstream |
| </pre></div> |
| </div> |
| </div></blockquote> |
| </li> |
| <li><p>Rebase onto the upstream code</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>rebase<span class="w"> </span>upstream/master |
| </pre></div> |
| </div> |
| </div></blockquote> |
| </li> |
| <li><p>Push to your remote</p> |
| <p>This needs to a force push with <code class="docutils literal notranslate"><span class="pre">-f</span></code>.</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>push<span class="w"> </span>-u<span class="w"> </span>my-branch<span class="w"> </span>-f |
| </pre></div> |
| </div> |
| </div></blockquote> |
| </li> |
| <li><p>Create a GitHub Pull Request</p> |
| <p>A Pull Request is how you ask your upstream to review and merge your changes.</p> |
| <p>Here’s <a class="reference external" href="https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request">GitHub’s instructions for creating a Pull Request</a>.</p> |
| <p>It is important to include an informative commit title and a commit message.</p> |
| <p>In the commit title please include the subsystem/area related to your contribution, |
| followed by a descriptive message. Some examples:</p> |
| <blockquote> |
| <div><p>Adding or fixing a platform</p> |
| <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>arch/arm/stm32/:<span class="w"> </span>Add<span class="w"> </span>arch<span class="w"> </span>support<span class="w"> </span><span class="k">for</span><span class="w"> </span>stm32<span class="w"> </span>platform |
| |
| This<span class="w"> </span>patch<span class="w"> </span>adds<span class="w"> </span>initial<span class="w"> </span>support<span class="w"> </span><span class="k">for</span><span class="w"> </span>stm32<span class="w"> </span>platform.<span class="w"> </span>Please<span class="w"> </span><span class="nb">read</span> |
| the<span class="w"> </span>documentation<span class="w"> </span>included<span class="w"> </span><span class="k">for</span><span class="w"> </span>more<span class="w"> </span>details<span class="w"> </span>how<span class="w"> </span>to<span class="w"> </span>wire<span class="w"> </span>the<span class="w"> </span>display. |
| |
| Signed-off-by:<span class="w"> </span>Your<span class="w"> </span>Name<span class="w"> </span><you@whoareyou.com> |
| </pre></div> |
| </div> |
| <p>Adding or fixing a board</p> |
| <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>arm/stm32f4discover:<span class="w"> </span>Add<span class="w"> </span>board<span class="w"> </span>initialization<span class="w"> </span><span class="k">for</span><span class="w"> </span>SSD1306<span class="w"> </span>OLED<span class="w"> </span>Display |
| |
| This<span class="w"> </span>patch<span class="w"> </span>adds<span class="w"> </span>support<span class="w"> </span>to<span class="w"> </span>use<span class="w"> </span>the<span class="w"> </span>display<span class="w"> </span>SSD1306<span class="w"> </span>on<span class="w"> </span>I2C1,<span class="w"> </span>please<span class="w"> </span><span class="nb">read</span> |
| the<span class="w"> </span>documentation<span class="w"> </span>included<span class="w"> </span><span class="k">for</span><span class="w"> </span>more<span class="w"> </span>details<span class="w"> </span>how<span class="w"> </span>to<span class="w"> </span>wire<span class="w"> </span>the<span class="w"> </span>display. |
| |
| Signed-off-by:<span class="w"> </span>Your<span class="w"> </span>Name<span class="w"> </span><you@whoareyou.com> |
| </pre></div> |
| </div> |
| </div></blockquote> |
| <p>Another example, submitting a commit to fix an issue in the fictional sensor xyz123:</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sensors/xyz123:<span class="w"> </span>Fix<span class="w"> </span>a<span class="w"> </span>pressure<span class="w"> </span>conversion<span class="w"> </span>resolution<span class="w"> </span>issue |
| |
| I<span class="w"> </span>found<span class="w"> </span>an<span class="w"> </span>issue<span class="w"> </span><span class="k">in</span><span class="w"> </span>the<span class="w"> </span>XYZ123<span class="w"> </span>sensor<span class="w"> </span>when<span class="w"> </span>converting<span class="w"> </span>the |
| pressure.<span class="w"> </span>The<span class="w"> </span>raw<span class="w"> </span>value<span class="w"> </span>should<span class="w"> </span>be<span class="w"> </span>divided<span class="w"> </span>by<span class="w"> </span><span class="m">4</span>.25<span class="w"> </span>instead |
| of<span class="w"> </span><span class="m">4</span>.52. |
| |
| Signed-off-by:<span class="w"> </span>Your<span class="w"> </span>Name<span class="w"> </span><you@whoareyou.com> |
| </pre></div> |
| </div> |
| </div></blockquote> |
| <p>You can search in the github commit history for more examples.</p> |
| </li> |
| <li><p>Get Pull Request feedback and implement changes</p> |
| <p>Get suggestions for improvements from reviewers, make changes, and push them to the branch. Once the reviewers are |
| happy, they may suggest squashing and merging again to make a single commit. In this case you would repeat steps |
| 1 through 6.</p> |
| </li> |
| </ol> |
| </section> |
| <section id="how-to-include-the-suggestions-on-your-pull-request"> |
| <h2>How to Include the Suggestions on Your Pull Request?<a class="headerlink" href="#how-to-include-the-suggestions-on-your-pull-request" title="Permalink to this heading"></a></h2> |
| <p>If you submitted your first PR (Pull Request) and received some feedbacks |
| to modify your commit, then probably you already modified it and created a |
| new commit with these modifications and submitted it.</p> |
| <p>Also probably you saw that this new commit appeared on your Pull Request at |
| NuttX’s github page (at Commits tab).</p> |
| <p>So, someone will ask you some enigmatic thing: “Please rebase and squash these commits!”</p> |
| <p>Basically what they are saying is that you need to update your repository |
| and fuse your commits in a single commit.</p> |
| <p>Let walk through the steps to do it!</p> |
| <p>Move to upstream branch and pull the new commits from there:</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>checkout<span class="w"> </span>upstream |
| $<span class="w"> </span>git<span class="w"> </span>pull |
| </pre></div> |
| </div> |
| </div></blockquote> |
| <p>Return to your working branch and rebase it with upstream:</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>checkout<span class="w"> </span>my-branch |
| $<span class="w"> </span>git<span class="w"> </span>rebase<span class="w"> </span>upstream |
| </pre></div> |
| </div> |
| </div></blockquote> |
| <p>If you run git log will see that your commits still there:</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>log |
| commit<span class="w"> </span>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx<span class="w"> </span><span class="o">(</span>HEAD<span class="w"> </span>-><span class="w"> </span>firstpr,<span class="w"> </span>upstream/master,<span class="w"> </span>upstream<span class="o">)</span> |
| |
| Author:<span class="w"> </span>Me<span class="w"> </span>Myself |
| Date:<span class="w"> </span>Today<span class="w"> </span>few<span class="w"> </span>seconds<span class="w"> </span>ago |
| |
| Fix<span class="w"> </span>suggestions<span class="w"> </span>from<span class="w"> </span>mainline |
| |
| commit<span class="w"> </span>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| |
| Author:<span class="w"> </span>Me<span class="w"> </span>Myself |
| Date:<span class="w"> </span>Today<span class="w"> </span>few<span class="w"> </span>minutes<span class="w"> </span>ago |
| |
| Initial<span class="w"> </span>support<span class="w"> </span><span class="k">for</span><span class="w"> </span>something<span class="w"> </span>fantastic |
| |
| commit<span class="w"> </span>6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
| Author:<span class="w"> </span>Xiang<span class="w"> </span>Xiao<span class="w"> </span><xiaoxiang@xiaomi.com> |
| Date:<span class="w"> </span>Sun<span class="w"> </span>Dec<span class="w"> </span><span class="m">18</span><span class="w"> </span><span class="m">00</span>:00:00<span class="w"> </span><span class="m">2022</span><span class="w"> </span>+0800 |
| |
| Some<span class="w"> </span>existing<span class="w"> </span>commit<span class="w"> </span>from<span class="w"> </span>mainline |
| </pre></div> |
| </div> |
| </div></blockquote> |
| <p>See, you have two commits (Fix suggestions… and Initial support…), we can squash both in a single commit!</p> |
| <p>You can use the git rebase interactive command to squash both commits:</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>rebase<span class="w"> </span>-i<span class="w"> </span>HEAD~2 |
| </pre></div> |
| </div> |
| </div></blockquote> |
| <p>Note: case you had 3 commits, then you should replace HEAD~2 with HEAD~3 and so on.</p> |
| <p>This command will open the nano editor with this screen:</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pick<span class="w"> </span>10ef3900b2<span class="w"> </span>Initial<span class="w"> </span>support<span class="w"> </span><span class="k">for</span><span class="w"> </span>something<span class="w"> </span>fantastic |
| pick<span class="w"> </span><span class="m">9431582586</span><span class="w"> </span>Fix<span class="w"> </span>suggestions<span class="w"> </span>from<span class="w"> </span>mainline |
| |
| <span class="c1"># Rebase 9b0e1659ea..9431582586 onto 9b0e1659ea (2 commands)</span> |
| <span class="c1">#</span> |
| <span class="c1"># Commands:</span> |
| <span class="c1"># p, pick <commit> = use commit</span> |
| ... |
| </pre></div> |
| </div> |
| </div></blockquote> |
| <p>Here you can control the actions that git will execute over your commits.</p> |
| <p>Because we want to squash the second commit with the first you need to |
| replace the ‘pick’ of the second line with a ‘squash’ (or just a ‘s’) this way:</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pick<span class="w"> </span>10ef3900b2<span class="w"> </span>Initial<span class="w"> </span>support<span class="w"> </span><span class="k">for</span><span class="w"> </span>something<span class="w"> </span>fantastic |
| squash<span class="w"> </span><span class="m">9431582586</span><span class="w"> </span>Fix<span class="w"> </span>suggestions<span class="w"> </span>from<span class="w"> </span>mainline |
| |
| <span class="c1"># Rebase 9b0e1659ea..9431582586 onto 9b0e1659ea (2 commands)</span> |
| <span class="c1">#</span> |
| <span class="c1"># Commands:</span> |
| <span class="c1"># p, pick <commit> = use commit</span> |
| ... |
| </pre></div> |
| </div> |
| </div></blockquote> |
| <p>Now just press <cite>Ctrl + X</cite> to save this modification. In the next screen you can edit your git |
| commit messages. After that press Ctrl + X again to save.</p> |
| <p>If you run git log again will see that now there is one a single commit:</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>log |
| commit<span class="w"> </span>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx<span class="w"> </span><span class="o">(</span>HEAD<span class="w"> </span>-><span class="w"> </span>firstpr,<span class="w"> </span>upstream/master,<span class="w"> </span>upstream<span class="o">)</span> |
| Author:<span class="w"> </span>Me<span class="w"> </span>Myself |
| Date:<span class="w"> </span>Right<span class="w"> </span>now<span class="w"> </span>baby,<span class="w"> </span>right<span class="w"> </span>now |
| |
| Initial<span class="w"> </span>support<span class="w"> </span><span class="k">for</span><span class="w"> </span>something<span class="w"> </span>fantastic |
| |
| This<span class="w"> </span>commit<span class="w"> </span>includes<span class="w"> </span>the<span class="w"> </span>suggestions<span class="w"> </span>from<span class="w"> </span>mainline |
| |
| commit<span class="w"> </span>6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
| Author:<span class="w"> </span>Xiang<span class="w"> </span>Xiao<span class="w"> </span><xiaoxiang@xiaomi.com> |
| Date:<span class="w"> </span>Sun<span class="w"> </span>Dec<span class="w"> </span><span class="m">18</span><span class="w"> </span><span class="m">00</span>:00:00<span class="w"> </span><span class="m">2022</span><span class="w"> </span>+0800 |
| |
| Some<span class="w"> </span>existing<span class="w"> </span>commit<span class="w"> </span>from<span class="w"> </span>mainline |
| </pre></div> |
| </div> |
| </div></blockquote> |
| <p>Just push forced this new commit to your repository:</p> |
| <blockquote> |
| <div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>push<span class="w"> </span>-f |
| </pre></div> |
| </div> |
| </div></blockquote> |
| <p>Now you can look at your PR at NuttX’s github to confirm that |
| this squashed commit is there.</p> |
| </section> |
| <section id="git-resources"> |
| <h2>Git Resources<a class="headerlink" href="#git-resources" title="Permalink to this heading"></a></h2> |
| <ul class="simple"> |
| <li><p><a class="reference external" href="https://github.github.com/training-kit/downloads/github-git-cheat-sheet.pdf">Git Cheat Sheet (by GitHub)</a></p></li> |
| <li><p><a class="reference external" href="https://git-scm.com/book/en/v2">Git Book (online)</a></p></li> |
| <li><p><a class="reference external" href="https://cwiki.apache.org/confluence/display/NUTTX/Code+Contribution+Workflow">NuttX Code Contribution Workflow (draft)</a> |
| – All the details are here if you need them!</p></li> |
| </ul> |
| </section> |
| </section> |
| |
| |
| </div> |
| </div> |
| <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer"> |
| <a href="workflow.html" class="btn btn-neutral float-left" title="Development Workflow" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a> |
| <a href="coding_style.html" class="btn btn-neutral float-right" title="C Coding Standard" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> |
| </div> |
| |
| <hr/> |
| |
| <div role="contentinfo"> |
| <p>© Copyright 2023, The Apache Software Foundation.</p> |
| </div> |
| |
| |
| |
| </footer> |
| </div> |
| </div> |
| </section> |
| </div> |
| <script> |
| jQuery(function () { |
| SphinxRtdTheme.Navigation.enable(true); |
| }); |
| </script> |
| |
| </body> |
| </html> |