Ikke's Blog

Post details: Development-related presentations using Git

May 8
Development-related presentations using Git

Yesterday I had to give some introduction presentation on Django, a Python-based web-application development framework (really cool, if you don't know it yet, take a look!).
The goal was to build some simple blog-like application during the presentation to give the audience an overview of the framework and some of it's basic capabilities (whilst still hand-coding everything, not using newforms/generic views/..., providing pointers to these great features though).

Obviously, at several points of the presentation, you got to show some example code. As most of the time you work on one source file during several stages of the presentation, you don't want to show the end file from the beginning, you want to incrementally add code.

There are some obvious ways to do this:

  • Type everything by hand at every stage
  • Have a source tree for each state in different directories
  • Give files a special name, like blog/models.py_slide19

These "solutions" got several problems though:

  • The first one is slow, error-prone and boring for the public
  • The second one is acceptable but uses a lot of diskspace
  • The last one is not acceptable as (in this case) because of the "wrong" filenames, you won't be able to run the django development server at the separate stages of development

The way I did it: put the code of your first slide in a (local) Git repository, create a new branch whenever you change code, check-out the branch, change the code and commit. Then when the presentation starts, git-check-out master, then everytime you're at a slide where you changed some code, git-check-out (name of the branch for this slide). I used "slideXX" as branch names, using just 1, 2, 3 etc might be better as my schema'd break if I had inserted a slide somewhere.

Really quick and easy to work this way!

Comments:

Comment from: JM Ibanez [Visitor] Email · http://jmibanez.livejournal.com/
With recent Git versions (starting from the latter 1.4s, I believe (I might be mistaken), but your best bet is 1.5) you can check out tags, which are semantically better than the branches -- as you're tagging the state of the tree for that particular slide. :)
PermalinkPermalink 05/08/07 @ 17:08
Comment from: Ikke [Member] · http://www.eikke.com
Good catch! Didn't think of that yet.
PermalinkPermalink 05/08/07 @ 17:22

Leave a comment:

Your email address will not be displayed on this site.
Your URL will be displayed.

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>
(Line breaks become <br />)
(Set cookies for name, email and url)
(Allow users to contact you through a message form (your email will NOT be displayed.))

Categories

Who's Online?

  • Guest Users: 170

Misc

XML Feeds

What is RSS?