@@ -9,8 +9,9 @@ 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
17
* When you are starting a new set of changes, fetch any changes from ``main ``,
@@ -23,10 +24,6 @@ In what follows we'll refer to the upstream Matplotlib ``main`` branch, as
23
24
`discourse <https://discourse.matplotlib.org >`__.
24
25
* Ask for a code review!
25
26
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.
29
-
30
27
.. note ::
31
28
32
29
It may sound strange, but deleting your own ``main `` branch can help reduce
@@ -35,21 +32,19 @@ what you've done, and why you did it.
35
32
36
33
.. _deleting main on github : https://matthew-brett.github.io/pydagogue/gh_delete_master.html
37
34
38
- .. _update-mirror-trunk :
35
+ .. _update-mirror-main :
39
36
40
- Update the mirror of trunk
41
- ==========================
37
+ Update the mirror of main
38
+ =========================
42
39
43
40
First make sure you have done :ref: `linking-to-upstream `.
44
41
45
- From time to time you should fetch the upstream (trunk) changes from github::
42
+ From time to time you should fetch the upstream changes from github::
46
43
47
44
git fetch upstream
48
45
49
46
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.
47
+ point to the right commit.
53
48
54
49
.. _make-feature-branch :
55
50
@@ -69,17 +64,17 @@ what the changes in the branch are for. For example ``add-ability-to-fly``, or
69
64
70
65
::
71
66
72
- # Update the mirror of trunk
67
+ # Update the mirror of main
73
68
git fetch upstream
74
- # Make new feature branch starting at current trunk
69
+ # Make new feature branch starting at current main
75
70
git branch my-new-feature upstream/main
76
71
git checkout my-new-feature
77
72
78
73
Generally, you will want to keep your feature branches on your public GitHub
79
74
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::
75
+ GitHub repo. Generally (if you followed the instructions in these pages, and by
76
+ default), git will have a link to your fork of the GitHub repo, called
77
+ `` origin ``. You push up to your own fork with::
83
78
84
79
git push origin my-new-feature
85
80
@@ -89,7 +84,7 @@ In git >= 1.7 you can ensure that the link is correctly set by using the
89
84
git push --set-upstream origin my-new-feature
90
85
91
86
From now on git will know that ``my-new-feature `` is related to the
92
- ``my-new-feature `` branch in the github repo.
87
+ ``my-new-feature `` branch in the GitHub repo.
93
88
94
89
.. _edit-flow :
95
90
@@ -174,55 +169,55 @@ To see a linear list of commits for this branch::
174
169
175
170
git log
176
171
177
- .. _rebase-on-trunk :
172
+ .. _rebase-on-main :
178
173
179
- Rebasing on trunk
180
- -----------------
174
+ Rebasing on main
175
+ ----------------
181
176
182
177
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:
178
+ :ref: `update-mirror-main ` and :ref: `make-feature-branch ` called
179
+ ``cool-feature ``. At this stage, `` main `` is at some commit, let's call it E.
180
+ Now you make some new commits on your ``cool-feature `` branch, let's call them
181
+ A, B, C. Maybe your changes take a while, or you come back to them after a
182
+ while. In the meantime, `` main `` has progressed from commit E to commit (say) G:
188
183
189
184
.. code-block :: none
190
185
191
186
A---B---C cool-feature
192
187
/
193
- D---E---F---G trunk
188
+ D---E---F---G main
194
189
195
- At this stage you consider merging trunk into your feature branch, and you
190
+ At this stage you consider merging `` main `` into your feature branch, and you
196
191
remember that this here page sternly advises you not to do that, because the
197
192
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.
193
+ worry that `` main `` has got a little ahead. But sometimes, the changes in
194
+ `` main `` might affect your changes, and you need to harmonize them. In this
195
+ situation you may prefer to do a rebase.
201
196
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:
197
+ `` rebase `` takes your changes (A, B, C) and replays them as if they had been
198
+ made to the current state of ``main ``. In other words, in this case, it takes
199
+ the changes represented by A, B, C and replays them on top of G. After the
200
+ rebase, your history will look like this:
206
201
207
202
.. code-block :: none
208
203
209
204
A'--B'--C' cool-feature
210
205
/
211
- D---E---F---G trunk
206
+ D---E---F---G main
212
207
213
208
See `rebase without tears `_ for more detail.
214
209
215
210
.. _rebase without tears : https://matthew-brett.github.io/pydagogue/rebase_without_tears.html
216
211
217
- To do a rebase on trunk ::
212
+ To do a rebase on `` main `` ::
218
213
219
- # Update the mirror of trunk
214
+ # Update the mirror of main
220
215
git fetch upstream
221
216
# go to the feature branch
222
217
git checkout cool-feature
223
218
# make a backup in case you mess up
224
219
git branch tmp cool-feature
225
- # rebase cool-feature onto trunk
220
+ # rebase cool-feature onto main
226
221
git rebase --onto upstream/main upstream/main cool-feature
227
222
228
223
In this situation, where you are already on branch ``cool-feature ``, the last
@@ -237,7 +232,7 @@ When all looks good you can delete your backup branch::
237
232
If it doesn't look good you may need to have a look at
238
233
:ref: `recovering-from-mess-up `.
239
234
240
- If you have made changes to files that have also changed in trunk , this may
235
+ If you have made changes to files that have also changed in `` main `` , this may
241
236
generate merge conflicts that you need to resolve - see the `git rebase `_ man
242
237
page for some instructions at the end of the "Description" section. There is
243
238
some related help on merging in the git user manual - see `resolving a merge `_.
0 commit comments