For the course, we make the final demo first, then rebuild a custom code history with git. It's not easy unless you already know how to use git well.
If you want to save the history of your project as you go, you'll want to learn a version control system. Git is the most widely used in open source projects, as it's designed to collaborate with large remote teams on complex projects. Here is a great guide: https://www.atlassian.com/git