I am working on a JavaScript tutorial series for someone who has no experience coding.
The format of the series is that it is a public Github repo. Each lesson is a README.md markdown document, and ends with an exercise. The exercise is usually some Jest tests that I've written, and the student needs to implement some functions to make the tests pass.
Also, all of the code examples I give in the readme, are contained in a index.js file (basically me making sure the syntax is correct, and that the output is correct), and I encourage the students to play around with it themselves.
You can see the series here.
One of the issues I've run into though, is that as this series is a work in progress (basically, I write the lesson and exercise, and my wife goes through it, and I get feedback on things I might have missed), I can easily push updates to the publish repo, but if the student has implemented the functions for the exercise, or played around with the index.js, and they do a simple git pull
they'll get merge conflicts.
Now this is a beginner JavaScript course, not a course about using git. Basically the level of git usage I expect a student to have is to be able to clone the repo in the first place, and to be able to run 'git pull' to receive updates.
The course is a introductory to using the terminal - I also get them to navigate to the project, and run commands like yarn
and yarn start
.
Teaching them to resolve merge conflicts seems like a distraction and a bridge too far.
So the question is - what's the best way I can make updates to the course and have the student receive them, while keeping things simple and not getting into teaching git.
Some thoughts I've had:
- Add an 'update' script, that runs something like
git checkout -- . && git pull
- This would remove all of their changes.- The problem with this solution is that it removes all of their changes. People often like to look back on code they're written to see how it works.
- Add an 'update' script that runs something like
git pull origin master -X theirs
- This won't cause merge conflicts, but the automatic merge could potentially break things and lead to confusion. - Add a 'prepare-lesson' script that copies all of the lesson code into a git ignored folder. The student can then play around in that folder and it won't be affected by incoming changes.
- This kind of has the same problem as the first option - if they need to run 'prepare-lesson' after each update, this will clobber their changess.
- Actually a good workaround is that each 'prepare-lesson' will copy into a new folder, so their old changes will in 'prepared-lesson-1' and the new changes will be in 'prepared-lesson-2',
- A similar approach might be that you have an 'update' script that is going to run
git checkout -- .
but before it does, it archives their changes to a git ignored folder.
Any suggestions or thoughts for solving this?