<spanclass="c1"># make a branch for your patching</span>
<spanclass="nb">cd</span> matplotlib
git branch the-fix-im-thinking-of
git checkout the-fix-im-thinking-of
<spanclass="c1"># hack, hack, hack</span>
<spanclass="c1"># Tell git about any new files you've made</span>
git add somewhere/tests/test_my_bug.py
<spanclass="c1"># commit work in progress as you go</span>
git commit -am <spanclass="s1">'BF - added tests for Funny bug'</span>
<spanclass="c1"># hack hack, hack</span>
git commit -am <spanclass="s1">'BF - added fix for Funny bug'</span>
<spanclass="c1"># make the patch files</span>
git format-patch -M -C main
</pre></div>
</div>
<p>Then, send the generated patch files to the <aclass="reference external" href="https://mail.python.org/mailman/listinfo/matplotlib-devel">Matplotlib
mailing list</a> — where we will thank you warmly.</p>
</section>
<sectionid="in-detail">
<h3>In detail<aclass="headerlink" href="#in-detail" title="Permalink to this heading">#</a></h3>
<olclass="arabic">
<li><p>Tell git who you are so it can label the commits you've
<spanclass="c1"># Tell git about any new files you've made</span>
git add somewhere/tests/test_my_bug.py
<spanclass="c1"># commit work in progress as you go</span>
git commit -am <spanclass="s1">'BF - added tests for Funny bug'</span>
<spanclass="c1"># hack hack, hack</span>
git commit -am <spanclass="s1">'BF - added fix for Funny bug'</span>
</pre></div>
</div>
<p>Note the <codeclass="docutils literal notranslate"><spanclass="pre">-am</span></code> options to <codeclass="docutils literal notranslate"><spanclass="pre">commit</span></code>. The <codeclass="docutils literal notranslate"><spanclass="pre">m</span></code> flag just
signals that you're going to type a message on the command
line. The <codeclass="docutils literal notranslate"><spanclass="pre">a</span></code> flag — you can just take on faith —
or see <aclass="reference external" href="http://gitready.com/beginner/2009/01/18/the-staging-area.html">why the -a flag?</a>.</p>
</li>
<li><p>When you have finished, check you have committed all your
changes:</p>
<divclass="highlight-bash notranslate"><divclass="highlight"><pre><span></span>git status
</pre></div>
</div>
</li>
<li><p>Finally, make your commits into patches. You want all the
commits since you branched from the <codeclass="docutils literal notranslate"><spanclass="pre">main</span></code> branch:</p>
<divclass="highlight-bash notranslate"><divclass="highlight"><pre><span></span>git format-patch -M -C main
</pre></div>
</div>
<p>You will now have several files named for the commits:</p>
<p>Send these files to the <aclass="reference external" href="https://mail.python.org/mailman/listinfo/matplotlib-devel">Matplotlib mailing list</a>.</p>
</li>
</ol>
<p>When you are done, to switch back to the main copy of the
code, just return to the <codeclass="docutils literal notranslate"><spanclass="pre">main</span></code> branch:</p>
<divclass="highlight-bash notranslate"><divclass="highlight"><pre><span></span>git checkout main
</pre></div>
</div>
</section>
</section>
<sectionid="moving-from-patching-to-development">
<h2>Moving from patching to development<aclass="headerlink" href="#moving-from-patching-to-development" title="Permalink to this heading">#</a></h2>
<p>If you find you have done some patches, and you have one or
more feature branches, you will probably want to switch to
development mode. You can do this with the repository you
have.</p>
<p>Fork the <aclass="reference external" href="http://matplotlib.org">Matplotlib</a> repository on github — <aclass="reference internal" href="forking_hell.html#forking"><spanclass="std std-ref">Making your own copy (fork) of Matplotlib</span></a>.
Then:</p>
<divclass="highlight-bash notranslate"><divclass="highlight"><pre><span></span><spanclass="c1"># checkout and refresh main branch from main repo</span>
git checkout main
git pull origin main
<spanclass="c1"># rename pointer to main repository to 'upstream'</span>
git remote rename origin upstream
<spanclass="c1"># point your repo to default read / write to your fork on github</span>
<!-- Scripts loaded after <body> so the DOM is not blocked -->
<divid="unreleased-message"> You are reading an old version of the documentation (v3.6.0). For the latest version see <ahref="https://matplotlib.org/stable/devel/gitwash/patching.html">https://matplotlib.org/stable/devel/gitwash/patching.html</a></div>