Personally, I've found it really useful to look at student's intermediate commits. I don't judge them on it in any way, but it's extremely useful for seeing how the students are thinking about a given problem.
Seeing your mistakes might be useful in reassuring the teacher that you did the work yourself, rather than simply plagiarising the solution from somewhere else.
Git just isn't the right tool for that. If I were to use this as a student, I would push nicely sanitized and consistent history after thoroughly rebasing, amending and fixup-ing my mistakes on my local clone.
There's nothing this too can do to prevent me from doing this.
If the teacher then judges the submission by also looking at the history, I will have an unfair advantage by just having read and internalized got features.
It does. First hand experience when after couple of months of not showing any progress student shows up with completed assignment coded using constructs which where not even taught in lectures... and when asked, can not modify a thing.
I was mostly joking in my previous comment, but i know students (including myself) that have occasionally submitted assignments as a single commit passing all test cases using “novel” constructs…of course, we can readily modify it if asked to.