@@ -9,23 +9,21 @@ Development workflow
9
9
Workflow summary
10
10
================
11
11
12
- In what follows we'll refer to the upstream Matplotlib ``main `` branch, as
13
- "trunk".
12
+ To keep your work well organized, with readable history, and in turn make it
13
+ easier for project maintainers (that might be you) to see what you've done, and
14
+ why you did it, we recommend the following:
14
15
15
16
* Don't use your ``main `` branch for anything. Consider deleting it.
16
- * When you are starting a new set of changes, fetch any changes from ``main ``,
17
- and start a new *feature branch * from that.
18
- * Make a new branch for each separable set of changes — "one task, one
19
- branch".
17
+ * Before starting a new set of changes, fetch all changes from
18
+ ``upstream/main ``, and start a new *feature branch * from that.
19
+ * Make a new branch for each feature or bug fix — "one task, one branch".
20
20
* Name your branch for the purpose of the changes - e.g.
21
21
``bugfix-for-issue-14 `` or ``refactor-database-code ``.
22
22
* If you get stuck, reach out on Gitter or
23
23
`discourse <https://discourse.matplotlib.org >`__.
24
- * Ask for a code review!
25
-
26
- This way of working helps to keep work well organized, with readable history.
27
- This in turn makes it easier for project maintainers (that might be you) to see
28
- what you've done, and why you did it.
24
+ * When your ready or need feedback on your code, open a pull-request so that the
25
+ Matplotlib developers can give feedback and eventually include your suggested
26
+ code into the ``main `` branch.
29
27
30
28
.. note ::
31
29
@@ -35,21 +33,19 @@ what you've done, and why you did it.
35
33
36
34
.. _deleting main on github : https://matthew-brett.github.io/pydagogue/gh_delete_master.html
37
35
38
- .. _update-mirror-trunk :
36
+ .. _update-mirror-main :
39
37
40
- Update the mirror of trunk
41
- ==========================
38
+ Update the mirror of main
39
+ =========================
42
40
43
41
First make sure you have done :ref: `linking-to-upstream `.
44
42
45
- From time to time you should fetch the upstream (trunk) changes from github::
43
+ From time to time you should fetch the upstream changes from github::
46
44
47
45
git fetch upstream
48
46
49
47
This will pull down any commits you don't have, and set the remote branches to
50
- point to the right commit. For example, 'trunk' is the branch referred to by
51
- (remote/branchname) ``upstream/main `` - and if there have been commits since
52
- you last checked, ``upstream/main `` will change after you do the fetch.
48
+ point to the right commit.
53
49
54
50
.. _make-feature-branch :
55
51
@@ -69,17 +65,17 @@ what the changes in the branch are for. For example ``add-ability-to-fly``, or
69
65
70
66
::
71
67
72
- # Update the mirror of trunk
68
+ # Update the mirror of main
73
69
git fetch upstream
74
- # Make new feature branch starting at current trunk
70
+ # Make new feature branch starting at current main
75
71
git branch my-new-feature upstream/main
76
72
git checkout my-new-feature
77
73
78
74
Generally, you will want to keep your feature branches on your public GitHub
79
75
fork of Matplotlib. To do this, you ``git push `` this new branch up to your
80
- github repo. Generally (if you followed the instructions in these pages, and by
81
- default), git will have a link to your github repo, called `` origin ``. You push
82
- up to your own repo on github with::
76
+ GitHub repo. Generally (if you followed the instructions in these pages, and by
77
+ default), git will have a link to your fork of the GitHub repo, called
78
+ `` origin ``. You push up to your own fork with::
83
79
84
80
git push origin my-new-feature
85
81
@@ -89,7 +85,7 @@ In git >= 1.7 you can ensure that the link is correctly set by using the
89
85
git push --set-upstream origin my-new-feature
90
86
91
87
From now on git will know that ``my-new-feature `` is related to the
92
- ``my-new-feature `` branch in the github repo.
88
+ ``my-new-feature `` branch in the GitHub repo.
93
89
94
90
.. _edit-flow :
95
91
@@ -145,8 +141,8 @@ In more detail
145
141
.. _tangled working copy problem : http://2ndscale.com/rtomayko/2008/the-thing-about-git
146
142
147
143
148
- Ask for your changes to be reviewed or merged
149
- =============================================
144
+ Open a pull request
145
+ ===================
150
146
151
147
When you are ready to ask for someone to review your code and consider a merge,
152
148
`submit your Pull Request (PR) <https://docs.github.com/pull-requests >`_.
@@ -174,55 +170,55 @@ To see a linear list of commits for this branch::
174
170
175
171
git log
176
172
177
- .. _rebase-on-trunk :
173
+ .. _rebase-on-main :
178
174
179
- Rebasing on trunk
180
- -----------------
175
+ Rebasing on `` upstream/main ``
176
+ -----------------------------
181
177
182
178
Let's say you thought of some work you'd like to do. You
183
- :ref: `update-mirror-trunk ` and :ref: `make-feature-branch ` called
184
- ``cool-feature ``. At this stage trunk is at some commit, let's call it E. Now
185
- you make some new commits on your ``cool-feature `` branch, let's call them A, B,
186
- C. Maybe your changes take a while, or you come back to them after a while. In
187
- the meantime, trunk has progressed from commit E to commit (say) G:
179
+ :ref: `update-mirror-main ` and :ref: `make-feature-branch ` called
180
+ ``cool-feature ``. At this stage, `` main `` is at some commit, let's call it E.
181
+ Now you make some new commits on your ``cool-feature `` branch, let's call them
182
+ A, B, C. Maybe your changes take a while, or you come back to them after a
183
+ while. In the meantime, `` main `` has progressed from commit E to commit (say) G:
188
184
189
185
.. code-block :: none
190
186
191
187
A---B---C cool-feature
192
188
/
193
- D---E---F---G trunk
189
+ D---E---F---G main
194
190
195
- At this stage you consider merging trunk into your feature branch, and you
191
+ At this stage you consider merging `` main `` into your feature branch, and you
196
192
remember that this here page sternly advises you not to do that, because the
197
193
history will get messy. Most of the time you can just ask for a review, and not
198
- worry that trunk has got a little ahead. But sometimes, the changes in trunk
199
- might affect your changes, and you need to harmonize them. In this situation
200
- you may prefer to do a rebase.
194
+ worry that `` main `` has got a little ahead. But sometimes, the changes in
195
+ `` main `` might affect your changes, and you need to harmonize them. In this
196
+ situation you may prefer to do a rebase.
201
197
202
- rebase takes your changes (A, B, C) and replays them as if they had been made to
203
- the current state of ``trunk ``. In other words, in this case, it takes the
204
- changes represented by A, B, C and replays them on top of G. After the rebase,
205
- your history will look like this:
198
+ `` rebase `` takes your changes (A, B, C) and replays them as if they had been
199
+ made to the current state of ``main ``. In other words, in this case, it takes
200
+ the changes represented by A, B, C and replays them on top of G. After the
201
+ rebase, your history will look like this:
206
202
207
203
.. code-block :: none
208
204
209
205
A'--B'--C' cool-feature
210
206
/
211
- D---E---F---G trunk
207
+ D---E---F---G main
212
208
213
209
See `rebase without tears `_ for more detail.
214
210
215
211
.. _rebase without tears : https://matthew-brett.github.io/pydagogue/rebase_without_tears.html
216
212
217
- To do a rebase on trunk ::
213
+ To do a rebase on `` upstream/main `` ::
218
214
219
- # Update the mirror of trunk
215
+ # Fetch changes from upstream/main
220
216
git fetch upstream
221
217
# go to the feature branch
222
218
git checkout cool-feature
223
219
# make a backup in case you mess up
224
220
git branch tmp cool-feature
225
- # rebase cool-feature onto trunk
221
+ # rebase cool-feature onto main
226
222
git rebase --onto upstream/main upstream/main cool-feature
227
223
228
224
In this situation, where you are already on branch ``cool-feature ``, the last
@@ -237,7 +233,7 @@ When all looks good you can delete your backup branch::
237
233
If it doesn't look good you may need to have a look at
238
234
:ref: `recovering-from-mess-up `.
239
235
240
- If you have made changes to files that have also changed in trunk , this may
236
+ If you have made changes to files that have also changed in `` main `` , this may
241
237
generate merge conflicts that you need to resolve - see the `git rebase `_ man
242
238
page for some instructions at the end of the "Description" section. There is
243
239
some related help on merging in the git user manual - see `resolving a merge `_.
0 commit comments