I have a repo of lessons that I'm using to teach a React class. (You can see it here).
Each lesson has a few files:
- a markdown document
- a test file
- an exercise file
- a solution file
- maybe some sample data
The students will work within the exercise file, building out react components to get the tests passing. Most of their changes will be here, but they will also be changing a few lines in the test file (changing
it when they are working on a new test.)
Everybody has created their own fork of this repo, and have cloned that. I have an
init script that adds the original repo as an
I'm making updates to the main repo as we move along: fixing some typos, and cleaning up the notes. I would like to figure out a way for my students to pull in these updates without losing the work that they have done.
A simple solution is doing
git fetch upstream && git merge --strategy-option ours upstream/master - which will pull in all new updates, but opt for the student's work whenever there is a merge conflict.
But, I also want the students to be able to merge in the updates if they choose to do so. One scenario would be if they had been struggling on a particular exercise and wanted to "reset" it.
An ideal tool would be an interactive CLI where:
- The student runs the 'update-lessons' script
- For each merge conflict, they can choose to either:
- Keep their own work
- Back up their own work, and merge in the new updates. For example, if there's a conflict in
./src/lesson1/exercise.js, they could choose this option and end up with:
./src/lesson1/exercise.js(The updated file)
./src/lesson1/exercise.5-30-2019.js(The work they had already done)
My students are fairly new to git, so I would want to provide them with something simple.
I don't know git well enough to figure this out, but if I were pointed in the right direction I could write some kind of bash script.
Does anyone know of any tools, workflows, or git magic that could do something like this?