I run web development coding workshops where I give students a starting repo, then want to have a version for the final, finished "solution". Ideally students should not see the solution easily until I publicise it.

I wondered if others have got a good workflow for this? I've tried tags and branches, but not found something I'm really happy or confident with yet.

  • 1
    $\begingroup$ I don't understand the problem. You could either post the solution at the end OR post it to a different repository and only reveal its location at the end. $\endgroup$
    – Buffy
    Commented Nov 20, 2017 at 14:19
  • 1
    $\begingroup$ Also, this is more of a Stack Overflow type of question as it is asking for technical solutions, not educational ones. $\endgroup$
    – Buffy
    Commented Nov 20, 2017 at 14:22
  • $\begingroup$ Don't there is more than one way to code a solution. I was just reading “mind storms” — Seymour Papert, in it there is a bit where he talks about a lesson in which he was observing, the pupils got stuck, and the teacher directed the pupils to a word document, where they could copy the correct code from. At the end of the lesson all pupils had working code. No pupil learnt anything. $\endgroup$ Commented Nov 20, 2017 at 14:28
  • $\begingroup$ Publishing a reference solution after the exercise ends is common practice. Just don't assume it is the only solution. Back in the olden days these were posted on paper outside the prof's office. It often generated a lot of forehead-smacking, of course. $\endgroup$
    – Buffy
    Commented Nov 20, 2017 at 14:46
  • $\begingroup$ If you are going to do this. Then two branchs in a private repo. Push 1st branch into public repo at start of term, then push 2nd branch (for the reveal) at the end. Pupils have to do a pull the start, and at the end, with a branch switch. Get a new puplic repo next year. $\endgroup$ Commented Nov 20, 2017 at 15:23

1 Answer 1


As far as I understood your question, you want two things:

  1. Providing a reference solution that is not visible to the students until the course is done.

  2. Having a way for your students to define a finished solution they can (probably only virtually) "hand in"1

Providing a reference solution

To achieve this, I would just create a repository containing the reference solution when the course is done and share the link with your students.

If you have the ability to create private repositories, you could use this to check that only your students have access to the reference solution (and not also the students of the course you give next year).

Defining a finished solution

Each student has their own working repository. As it's necessary that all of them start with a given initial set of files, they could create their repository by forking a "starter pack" repository you provide. If this wasn't required, they could just create a new empty repository on their own.

To mark a state as finished, I would use branches. You could for example require your students to create a solution branch in their repository once they are done.

Having everything in one namespace (optional)

Most Git hosters allow the creation of organizations or groups. If you want to, you could create one for each course you give. This organization would then contain the working repository of each student and the reference solution when the course is done.

This would provide an easier overview for you over your students' repositories.

1 After reading through your question another time, I guess I've misunderstood the question and you only asked for a solution for the first item in my list. I think I will nevertheless share my thoughts on both - maybe they can be helpful for you or any future visitor.

  • $\begingroup$ Thanks for the answer. This is getting there, but the starter and the solution are ideally in the same repo (as the latter is just the fully developed version of the former). I think the comment above from @ctrl-alt-delor is closer to what I should be doing $\endgroup$
    – paulusm
    Commented Dec 11, 2017 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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