Andres Perez (1) [Avatar] Offline
#1
Before I ask my question, I would like to congratulate Mike McQuaid for his excellent book. I have been looking for a book that is more than the basic information you find everywhere but not as advanced as a reference guide with all the things you need and don't need about git.

I teach programming courses and I would like to use Git to manage the exercise and solution files for my classes. I am thinking of a single repository for each class, where I will be using tags to identify the different exercises (for example EX2-1, EX3-2-Solution). The students will be able to check out the commit associated with that branch to get the files for a particular exercise.

It's important to mention, the student will not be making any changes to the repository, they only need check out a specific commit, identified by the tag and copy the files into their own folder. Assume the student will clone the repository from a private repository in GitHub at the beginning of each semester.

The repository is just a way for me to maintain the evolution of the solution files.

So far this is easy, but here lies the problem...

Let's suppose I notice that one of the files for EX2-4 has a bug (which was not intended to be there, was not part of the learning objectives). I want to fix the code and put the fixed file back in that commit so that when the students check out EX2-4 they see the new file.

Also, EX2-5 uses the same file and when they check out the commit identified with the EX2-5 tag, I want the students to get the fixed file.

One more thing, during EX2-6 the students are required to make changes to the same file (different from the bug I fixed) so the files in EX2-6-Solution should be a file that has my fix (for the bug) and the answers to the exercise.

Finally, EX2-7 has the same file that is found in EX2-6-Solution.

Thank you so much for any suggestion you may offer.
Mike McQuaid (83) [Avatar] Offline
#2
Thanks for the kind words. As a high level comment I'd suggest that requiring the students use the Git repository but not commit to it seems a bit odd; it would perhaps be nicer to just distribute the files to them and suggest they use their own GitHub repository or have on repository per exercise which they could e.g. fork on GitHub.

As for modifying the tags: if you ever ask yourself "how can I modify this tag" you're better just using a branch instead. In your case, therefore, I'd suggest using a branch for each exercise rather than a tag.

Hope that helps!