[Python-Dev] PEP: Collecting information about git

Barry Warsaw barry at python.org
Sun Sep 13 20:10:42 CEST 2015


On Sep 12, 2015, at 03:54 PM, Oleg Broytman wrote:

>This Informational PEP collects information about git. There is, of course, a
>lot of documentation for git, so the PEP concentrates on more complex (and
>more related to Python development) issues, scenarios and examples.

Thanks for this Oleg.  git is popular and powerful, but with that power comes
a lot of options, command line switches, complexity, and verbose manpages.
Boiled down, you don't have to learn all of that to be effective, and you can
augment your knowledge as you go, although it's sometimes difficult to find
the exact bit of advice you're looking for.  A sprinkling of git aliases has
definitely made my life easier. :)

One of the things I think is missing from most git documentation, is an
effective workflow for handling multiple branches.  Think about the Python
case where we have the default branch for what is now going to be Python 3.6,
plus stable release branches for several older Python 3 versions, and even
Python 2.7.

Now imagine a bug fix which must be applied to many of these active branches.
There are lots of different ways to do this, but really no best practices for
how it should be done.  Do you apply the fix to the highest version branch and
then cherry pick to the older version branches?  What about if you need to
skip one of those branches?

Visually, it would be something like this:

master -> A -> B ------------->-> F -> G
                \                /
   issue1 -----> -> C -> D -> E /

releaseX.Y -> H -> I

At this point you'd like to take the commits C->E, rebase them onto I and then
commit them to the releaseX.Y branch, e.g.

releaseX.Y -> H -> I -----------------> J
                    \                  /
   issue1-X.Y -=--> -> C' -> D' -> E' /

I do this with several of my projects and personally find git cherry-pick to
be useful, but also often non-intuitive, and sometimes it just doesn't do what
I want it to do.  I haven't found a lot of really good workflow documentation
for git, so most of what I do is based on experimentation, with a healthy dose
of frustration when my expectations aren't met.

Our devguide has some good documentation on how to do this with hg, and even
though I so rarely do it (CPython being one of the only projects I use
Mercurial on), I can usually get the job done without a lot of cursing. :)

So, for this very interesting informational PEP, I'd like to see detailed
documentation on best practices for applying patches to multiple active
branches using git, in the context of CPython development.

Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150913/62cf901b/attachment.sig>


More information about the Python-Dev mailing list