Skip to content

Commit 3705a2f

Browse files
committed
Merge branch 'v1.0.x'
2 parents 4ef0163 + 0c9e4b4 commit 3705a2f

File tree

3 files changed

+103
-21
lines changed

3 files changed

+103
-21
lines changed

doc/devel/gitwash/development_workflow.rst

Lines changed: 94 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,14 @@ Making a new feature branch
2929

3030
::
3131

32-
git branch my-new-feature
33-
git checkout my-new-feature
32+
git checkout -b my-new-feature master
33+
34+
This will create and immediately check out a feature branch based on
35+
``master``. To create a feature branch based on a maintenance branch,
36+
use::
37+
38+
git fetch origin
39+
git checkout -b my-new-feature origin/v1.0.x
3440

3541
Generally, you will want to keep this also on your public github_ fork
3642
of matplotlib_. To do this, you `git push`_ this new branch up to your github_
@@ -40,13 +46,16 @@ by default), git will have a link to your github_ repo, called
4046

4147
git push origin my-new-feature
4248

43-
In git >1.7 you can ensure that the link is correctly set by using the
44-
``--set-upstream`` option::
49+
You will need to use this exact command, rather than simply ``git
50+
push`` every time you want to push changes on your feature branch to
51+
your github_ repo. However, in git >1.7 you can set up a link by
52+
using the ``--set-upstream`` option::
4553

4654
git push --set-upstream origin my-new-feature
4755

48-
From now on git_ will know that ``my-new-feature`` is related to the
49-
``my-new-feature`` branch in the github_ repo.
56+
and then next time you need to push changes to your branch a simple
57+
``git push`` will suffice. Note that ``git push`` pushes out all
58+
branches that are linked to a remote branch.
5059

5160
The editing workflow
5261
====================
@@ -73,12 +82,12 @@ In more detail
7382
# (use "git add <file>..." to update what will be committed)
7483
# (use "git checkout -- <file>..." to discard changes in working directory)
7584
#
76-
# modified: README
85+
# modified: README
7786
#
7887
# Untracked files:
7988
# (use "git add <file>..." to include in what will be committed)
8089
#
81-
# INSTALL
90+
# INSTALL
8291
no changes added to commit (use "git add" and/or "git commit -a")
8392

8493
#. Check what the actual changes are with ``git diff`` (`git diff`_).
@@ -125,7 +134,7 @@ without interfering with the output from the comparison. More detail?
125134
Note the three dots in the URL above (``master...my-new-feature``) and
126135
see :ref:`dot2-dot3`.
127136

128-
Asking for your changes to be merged with the main repo
137+
Asking for your changes to be merged into the main repo
129138
=======================================================
130139

131140
When you are ready to ask for the merge of your code:
@@ -140,10 +149,16 @@ When you are ready to ask for the merge of your code:
140149
recipient. The message will go to the `matplotlib mailing list`_. Please
141150
feel free to add others from the list as you like.
142151

143-
Merging from trunk
144-
==================
152+
#. If the branch is to be merged into a maintenance branch on the main
153+
repo, make sure the "base branch" indicates the maintenance branch
154+
and not master. Github can not automatically determine the branch
155+
to merge into.
145156

146-
This updates your code from the upstream `matplotlib github`_ repo.
157+
Staying up to date with changes in the central repository
158+
=========================================================
159+
160+
This updates your working copy from the upstream `matplotlib github`_
161+
repo.
147162

148163
Overview
149164
--------
@@ -155,7 +170,7 @@ Overview
155170
# pull changes from github
156171
git fetch upstream
157172
# merge from upstream
158-
git merge upstream/master
173+
git merge --ff-only upstream/master
159174

160175
In detail
161176
---------
@@ -175,7 +190,72 @@ the upstream repo to a copy on your local machine::
175190

176191
then merging into your current branch::
177192

178-
git merge upstream/master
193+
git merge --ff-only upstream/master
194+
195+
The ``--ff-only`` option guarantees that if you have mistakenly
196+
committed code on your ``master`` branch, the merge fails at this point.
197+
If you were to merge ``upstream/master`` to your ``master``, you
198+
would start to diverge from the upstream. If this command fails, see
199+
the section on accidents_.
200+
201+
The letters 'ff' in ``--ff-only`` mean 'fast forward', which is a
202+
special case of merge where git can simply update your branch to point
203+
to the other branch and not do any actual merging of files. For
204+
``master`` and other integration branches this is exactly what you
205+
want.
206+
207+
Other integration branches
208+
--------------------------
209+
210+
Some people like to keep separate local branches corresponding to the
211+
maintenance branches on github. At the time of this writing, ``v1.0.x``
212+
is the active maintenance branch. If you have such a local branch,
213+
treat is just as ``master``: don't commit on it, and before starting
214+
new branches off of it, update it from upstream::
215+
216+
git checkout v1.0.x
217+
git fetch upstream
218+
git merge --ff-only upstream/v1.0.x
219+
220+
But you don't necessarily have to have such a branch. Instead, if you
221+
are preparing a bugfix that applies to the maintenance branch, fetch
222+
from upstream and base your bugfix on the remote branch::
223+
224+
git fetch upstream
225+
git checkout -b my-bug-fix upstream/v1.0.x
226+
227+
.. _accidents:
228+
229+
Recovering from accidental commits on master
230+
--------------------------------------------
231+
232+
If you have accidentally committed changes on ``master`` and
233+
``git merge --ff-only`` fails, don't panic! First find out how much
234+
you have diverged::
235+
236+
git diff upstream/master...master
237+
238+
If you find that you want simply to get rid of the changes, reset
239+
your ``master`` branch to the upstream version::
240+
241+
git reset --hard upstream/master
242+
243+
As you might surmise from the words 'reset' and 'hard', this command
244+
actually causes your changes to the current branch to be lost, so
245+
think twice.
246+
247+
If, on the other hand, you find that you want to preserve the changes,
248+
create a feature branch for them::
249+
250+
git checkout -b my-important-changes
251+
252+
Now ``my-important-changes`` points to the branch that has your
253+
changes, and you can safely reset ``master`` as above |emdash| but
254+
make sure to reset the correct branch::
255+
256+
git checkout master
257+
git reset --hard upstream/master
258+
179259

180260
Deleting a branch on github_
181261
============================

doc/devel/gitwash/set_up_fork.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,17 @@ Note that we've used ``git://`` for the URL rather than ``git@``. The
5656
(or deliberately) write to the upstream repo, and we are only going to
5757
use it to merge into our own code.
5858

59+
Note this command needs to be run on every clone of the repository
60+
that you make. It is not tracked in your personal repository on
61+
github_.
62+
5963
Just for your own satisfaction, show yourself that you now have a new
6064
'remote', with ``git remote -v show``, giving you something like::
6165

62-
upstream git://github.com/matplotlib/matplotlib.git (fetch)
63-
upstream git://github.com/matplotlib/matplotlib.git (push)
64-
origin git@github.com:your-user-name/matplotlib.git (fetch)
65-
origin git@github.com:your-user-name/matplotlib.git (push)
66+
upstream git://github.com/matplotlib/matplotlib.git (fetch)
67+
upstream git://github.com/matplotlib/matplotlib.git (push)
68+
origin git@github.com:your-user-name/matplotlib.git (fetch)
69+
origin git@github.com:your-user-name/matplotlib.git (push)
6670

6771
.. include:: links.inc
72+

lib/matplotlib/backends/backend_qt4.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
import matplotlib.backends.qt4_editor.figureoptions as figureoptions
2020
except ImportError:
2121
figureoptions = None
22-
figureoptions = None
23-
24-
print figureoptions
2522

2623
try:
2724
from PyQt4 import QtCore, QtGui

0 commit comments

Comments
 (0)