Revision control for writing programming lessons

Posted by Dietrich Epp on Stack Overflow See other posts from Stack Overflow or by Dietrich Epp
Published on 2010-04-16T20:29:07Z Indexed on 2010/04/16 20:33 UTC
Read the original article Hit count: 336

Filed under:
|

I'd like to write a series programming lessons that guide programmers to build a certain kind of program. After each lesson, I'd like to provide sample code that implements what that lesson covered, and the next lesson would use that code as a starting point.

Right now I'm using Git to keep track of the code from lesson to lesson. Each lesson has its own branch.

lesson1: A--B--C
                \
lesson2:         D--E--F
                        \
lesson3:                 G--H--I

However, suppose that now I want to make it easier on the Windows programmers using my lessons, so I add a Visual Studio project to lesson 1 and then merge it into lessons 2 and 3.

lesson1: A--B--C--------------J
                \              \
lesson2:         D--E--F--------K
                        \        \
lesson3:                 G--H--I--L

And then someone points out a bug in lesson 2 that causes crashes on certain systems. (This diagram is where I am right now, and I'm having doubts about continuing along this path.)

lesson1: A--B--C--------------J
                \              \
lesson2:         D--E--F--------K--M
                        \        \  \
lesson3:                 G--H--I--L--N

Here are the problems I imagine having:

  • If I had many lessons, and I fix something in lesson 1, am I going to have to spend fifteen minutes or more just merging that one simple change? I know I'll probably have to test all of those lessons again, but I can put that off.

  • When I make a bunch of changes to various lessons on one computer, how do I pull all of the branches at the same time?

  • If I decide to publish these lessons, I'd like a way to tag all of the branches to correspond with what I publish. I figure I'll just need to tag each branch separately, but it would be nice if there were a better way.

  • When I look at the history, I imagine becoming terribly confused about what I've done. Compare the above diagram to a hypothetical diagram below, where I use rebase instead of merge (and rebase has its own problems):

lesson1: A--B--C--J
                   \
lesson2:            D2--E2--F2--M
                                 \
lesson3:                          G2--H2--I2

Do any of you have experience working with a project like this? Should I consider using a different VCS, such as Darcs? (Note: it would be a real pain to use centralized VCS, so don't suggest one of those unless the benefits are clear.) Should I consider writing plugins or extra tools for a VCS (such as a "meta tag" which tags several branches)?

© Stack Overflow or respective owner

Related posts about version-control

Related posts about education