1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
================
Making a patch
================
.. _making-patches:
Making patches
==============
Overview
--------
::
# tell git who you are
git config --global user.email you@yourdomain.example.com
git config --global user.name "Your Name Comes Here"
# get the repository if you don't have it
git clone git://github.com/matplotlib/matplotlib.git
# make a branch for your patching
cd matplotlib
git branch the-fix-im-thinking-of
git checkout the-fix-im-thinking-of
# hack, hack, hack
# Tell git about any new files you've made
git add somewhere/tests/test_my_bug.py
# commit work in progress as you go
git commit -am 'BF - added tests for Funny bug'
# hack hack, hack
git commit -am 'BF - added fix for Funny bug'
# make the patch files
git format-patch -M -C master
Then, send the generated patch files to the `matplotlib
mailing list`_ |emdash| where we will thank you warmly.
In detail
---------
#. Tell git_ who you are so it can label the commits you've
made::
git config --global user.email you@yourdomain.example.com
git config --global user.name "Your Name Comes Here"
#. If you don't already have one, clone a copy of the
matplotlib_ repository::
git clone git://github.com/matplotlib/matplotlib.git
cd matplotlib
#. Make a 'feature branch'. This will be where you work on
your bug fix. It's nice and safe and leaves you with
access to an unmodified copy of the code in the main
branch::
git branch the-fix-im-thinking-of
git checkout the-fix-im-thinking-of
#. Do some edits, and commit them as you go::
# hack, hack, hack
# Tell git about any new files you've made
git add somewhere/tests/test_my_bug.py
# commit work in progress as you go
git commit -am 'BF - added tests for Funny bug'
# hack hack, hack
git commit -am 'BF - added fix for Funny bug'
Note the ``-am`` options to ``commit``. The ``m`` flag just
signals that you're going to type a message on the command
line. The ``a`` flag |emdash| you can just take on faith |emdash|
or see `why the -a flag?`_.
#. When you have finished, check you have committed all your
changes::
git status
#. Finally, make your commits into patches. You want all the
commits since you branched from the ``master`` branch::
git format-patch -M -C master
You will now have several files named for the commits::
0001-BF-added-tests-for-Funny-bug.patch
0002-BF-added-fix-for-Funny-bug.patch
Send these files to the `matplotlib mailing list`_.
When you are done, to switch back to the main copy of the
code, just return to the ``master`` branch::
git checkout master
.. include:: links.inc
|