Is using git performed as steps in a tutorial / master class?

I am planning a sequence of lessons on how to create a web application using a demo application and create it from scratch.

I would like to use git for 1) the demo code of the demo application and 2) for the git commit team to help find students.

Each lesson is a small step in creating a web application. I would like each lesson to correspond to one git declaration, where the student could see exactly what code was changed in the lesson by looking at the lesson's commit on GitHub.

That I'm not sure how to do this and make it supported, so the commit history is always in the sequence of lessons. Or is there an alternative technique commonly used for this that I don't know about (e.g. using branches / tags / patches)? My main concerns:

  • Corrections and updates to the lessons / commits and the provision of these changes appear during subsequent commits
  • Dependency updates such as third-party JavaScript libraries in any of the commits
  • Keeping the commit history in order so that each commit is equal to one lesson and appears in sequence. If the first commit / lesson is updated much later, after it was originally completed, it should still be the first record in the commit log.

Guide, suggestions, feedback and improvements are welcome, thanks in advance!

+1
source share
3 answers

Use branches - one branch for each lesson. Therefore, if you need to update the content of the lesson, just make a fix in the branch of the lesson and, if necessary, simply connect them to all subsequent branches of the lessons.

Examples:

The two branches can be easily compared to show what's new in any given lesson. For example, git diff lesson02..lesson03 shows what's new in lesson 3.


Rewriting git repo history (reboot, change, etc.) is usually out of order. Please do not show your students otherwise. The git commit log will help much better if it turns on and does not hide all bug fixes, updates, etc.

+2
source

git rebase interactively should handle most of your use cases:

making corrections and updates to lessons / commits
Check out this post that describes how you are going to change the file / commit from the previous lesson. You need to use git rebase -i to enter interactive reinstall mode. After you select the commit you want to change, you modify it with git commit --amend , and then continue rebase.

dependency updates
Here is a post discussing how to add a new file to the interactive redirection mode. This is an opportunity to use if you need to add a new dependency to a lesson / commit. This is a bit more complicated than just modifying an existing file. As you might have guessed, you are doing git add inside rebase.

When using rebase in both cases, you should keep in mind that you are rewriting the history of your lessons. As a result, if you git push -force share the lessons into a repository, you git push -force risk of causing some confusion for your students.

+1
source

If you remove the logging restriction in order so that it can be read as a tutorial script, you can use tags. I got the impression that tags simplify and improve service.

Question How to create a coding tutorial with snapshots in Git describes the approach and points to the AngularJS tutorial that uses tags. The tutorial contains links to code comparison: https://github.com/angular/angular-phonecat/compare/step-0...step-1

I plan to use this approach, so I will need to become more familiar with the git tag and update the commit associated with the tag .

0
source

All Articles