Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm teaching a scientific programming course to undergraduates, targeted at freshmen/sophomores who are seeing the command line for the first time but are likely to need version control in future classes and careers.

Are there resource for teaching version control (to those who have never seen it) available? What aspects should be taught first / emphasized most?

share|improve this question

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

closed as not constructive by gnat, Walter, Matthieu, Yusubov, Mark Trapp Sep 3 '12 at 2:44

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.

hginit.com springs to mind. –  dan_waterworth Aug 30 '12 at 16:51
+1 to you for trying this. I first used svn in my very last CS class. To have had that from the beginning... –  Matt Stephenson Aug 30 '12 at 18:11
@Matt: I used RCS + home-grown scripts in my very last CS class, at the direction of the professor. A student asked about using CVS instead and the prof scoffed, deriding it as "RCS plus some buggy scripts". The irony was not apparent to me until much later, sadly. (Oh how time flies... this event predates Subversion.) To have had CVS from the beginning... –  retracile Aug 30 '12 at 18:23
Spoil them with Perforce –  James Aug 30 '12 at 21:24
+1. This is probably one of the best things you could do for your students. My peers and I were lucky enough to have been taught version control in our second year... there were many projects and assignments that were saved in year 3, 4, and 5 thanks to having been taught this early on. –  Kristen D. Aug 30 '12 at 21:42

7 Answers 7

up vote 2 down vote accepted

As everyone has said - start with very simple stuff. Tarballs, file copies etc are a form of Version control, introduce that first as it can be, has been, and in too many cases still is, done that way. Discuss the pros and cons. This will lead to a "tool" to solve the problems

While still focusing on single developer, introduce checkout and commit, compare to / checkout earlier version etc. Don't ask them to set up a repo first... even with GIT of HG, that is too much too soon, as although the mechanics is trivial, the concept is not understood. Get the students use to the idea that a VCS use is normal for a single developer. Repo management, including create, how to backup reliably etc comes next.

Now introduce Merging - hence branching - this is the killer feature of VCS (Except CVS, but this is a uni course in 2012) I would go as far as showing the merge of a complex set of changes by two people (carefully selected to have no merge conflicts). e.g. Looks at this - his 100 lines and your 200 lines in merged into the same file with no typing - Wow. - Then move to showing merge conflicts and discussion on avoidance and then resolution strategies and how to avoid them, when and why (or why not)

Now they have the basic concepts of how 2 people can work together, introduce a "feature branch" concept and a "roll back to fix bug" concept.

Discuss things that cause needless problems with merges, such as white space changes causing conflicts, the cost of layout changes etc tat are not needed. Make a two trival changes to a file, and then merge them. Now make the same two changes and change the formatting of the file in each, (e.g. One change tabs to spaces, the other change indentation from 2 to 4) and ask the students to merge them.

Discuss the distinction between VCS and Configuration Management - many developers have no idea where the line is and think that a good VCS achieves CM. (i.e. VCS stores revisions, CM manages revisions)

share|improve this answer

There's a great book called "Version Control by Example" written by Eric Sink. It contains short coverage of both centralized and decentralized version control. It contains the fundamental ideas behind both, their strengths and weaknesses and basic usage examples of Subversion(centralized) and Mercurial, Git and Veracity(all decentralized). At the very end there are chapters covering workflows, internals of distributed version control and best practices.

share|improve this answer
I have this book. I didn't read it yet, but I heard it's very good :) . –  Radu Murzea Aug 31 '12 at 10:01
I got the book off Amazon for $4, so I'll have a closer look in a day or two. –  keflavich Aug 31 '12 at 14:49
I've seen excerpts from this book. Pretty well written. –  Qix Aug 31 '12 at 17:17

I can't count the number of times I wish I could go back and tell my freshman self about source control. I'm glad to see someone trying to introduce it early in a curriculum. So first off, don't give up on this.

zxcdw's suggestion of Eric Sink's book "Version Control by Example" is a good one, particularly as a basic intro the the range of options. (Be warned that he shows Subversion without /trunk,/branches,/tags to start, then goes back and fixes that up -- something I wish he'd done differently, but he was trying to show mistakes along the way, and it does avoid addressing branching concepts too early in the storyline.)

I would suggest picking one (such as Mercurial) that can be used cross-platform on their own, without needing a university service or something. Then give them step-by-step instructions on how to set it up on their own. Also emphasize that this will help them in all their programming tasks, not just for your class.

I'd also suggest blowing their minds with bisect -- most of the students probably won't get it, but I think it's a tool that will help the best students accelerate.

share|improve this answer

The first thing to remember is that your objective is to teach them about Version Control - not git or mercurial or veracity or svn or perforce but Version Control. This is slightly challenging as the different systems have differing strengths and weaknesses and worse (from a teaching point of view) espouse different philosophies - which means that the expected working practices are different - and you don't want to drag your students into zealotry.

That said, its probably easier to pick a single tool to use by default - especially as VCS is not the focus of the course.

In terms of what to teach:

  1. Why do we need version control (mostly to protect us from ourselves! Individually as well as part of a team)
  2. What are the basic operations for version control (roughly: checkout, update, commit, tag, branch, merge)
  3. In conjunction with the above - how do we perform these operations using x (where x is the local vcs of choice)
  4. If you want to do it properly, you use different VCS in turn... and of course all submissions are via VCS too.
share|improve this answer

For what to teach first you'll want to start with the fundamentals:

  • Adding to source control.
  • Checking in items to source control.
  • Reverting pending changes.
  • Getting latest / specific versions.

Once those basics have been taught and they are comfortable with it I would emphasize dealing with merge conflicts and strategies for preventing it / resolving it. We've all had to deal with issues where a dev mindlessly clicks on overwrite server version without checking what the differences between the files are.

Since this is an undergraduate course, however, that lesson can potentially be left for the 3000/4000 level classes to come.

If you can give them a good foundation on why version control is important and they are able to do the four bulleted items above I would consider that a win. When I was in college this material wasn't covered at all and I had to learn it as I went in a higher stress business environment. If there's enough time I would also cover the topics of branching and the differences between distributed and centralized source control at a high level. I would not expect 1000/2000 level students to be able to learn this in one semester (not in addition to actually learning to program anyway).

share|improve this answer

I know a couple of schools in my area (southern Sweden) that have been teaching VCS quite early in their curriculum.

University of Lund teaches VCS in a practical course for second year computer engineering students. The course actually uses XP (extreme programming) to teach software engineering skills (requirements, implementation, testing) and give some theory in the first half of the term, where a lecture in VCS is taught. On the second half of the term they throw the students in teams on a well-defined project (with some wrenches thrown in to the machinery for good measure). They work one full day a week in the computer lab which they have to use version control so that they don't loose their changes.

When I went to that course, we were taught to use CVS, but they've currently switched to SVN (and optionally use GIT). During the lecture we are also taught the three key problems with working concurrently: Double Maintenance, Shared Data and Simultaneous Update which explains why we do version control at all.

At Malmö University I know there have been experiments with using version control a way to hand in assignments for reviews in courses like web design. The results are mixed, as in some didn't grasp the whole thing, but in general everyone were using it to check in their changes for review (mostly because they were forced to). This strengthens the fact that anyone can use version control at some capacity.

share|improve this answer

Something to supplement a more serious source (books,tutorials,lectures), GitImmersion is absolutely fantastic and provides you with some nice short, scenarios.

This may not give them the greater picture however. You really need to understand at the beginning : WHY do I need version control? WHO uses version control?

A simple screencast/lecture with two users would be a great intro. Two guys at the podium, working on the same codebase, then mistakes happen. Explain how to avoid these mistakes, then move to a version control system, do some branching, merging, nothing fancy, just solve some problems up front.

I think hardest thing about teaching it initially, is getting people interested.

EDIT: btw, noone during my 3 years in my degree ever, ever even mentioned version control to us! You are literally saving them all from hours of pain by teaching this stuff!

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.