使用git提交作为教程/研讨会步骤? [英] Using git commits as tutorial/workshop steps?

查看:112
本文介绍了使用git提交作为教程/研讨会步骤?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在计划一系列关于如何使用演示应用程序构建Web应用程序并从头构建它的课程。



我想使用git for 1)演示应用程序代码的回购, 2)拥有git commit日志帮助指导学生。

每课都是构建Web应用程序的一小步。我希望每个课程都对应一个git commit,学生可以通过查看GitHub上的课程提交确切了解本课程中更改了哪些代码。



我不确定如何做到这一点,并使其可维护,因此提交历史记录始终是按顺序排列的。还是有一种替代技术常用来做到这一点,我不知道(如使用分支/标签/补丁)?我主要关注的是:
$ b


  • 更正和更新课程/提交并确保在随后的提交中出现这些更改

  • 更新任何提交中的依赖项(如第三方JavaScript库)
  • 保持提交历史记录的顺序,以便每次提交都等于一课,并且它出现在序列。如果第一次提交/课程在最初提交后更新很久,那么它应该仍然是提交日志中的第一个条目。



<

解决方案

使用分支

strong> - 每节课一个分支。因此,如果您之后需要更新课程内容,只需在课程分支中进行提交,并在需要时将其合并到所有以下课程分支。



例子:



两个分支可以轻松比较以显示任何课程中的新内容。例如 git diff lesson02..lesson03 显示了第3课中的新功能。




重写git repo的历史记录(rebasing,修改等)通常不会。请别显示你的学生。如果git提交日志包含并不隐藏所有错误修正,升级更改等,git提交日志将有助于更好地引导学生。


I'm planning a sequence of lessons for how to build a web app using a demo app and building it from the ground up.

I would like to use git for 1) a repo of the demonstration app's code, and 2) have the git commit log help guide students.

Each lesson is a small step in building the web app. I'd like each lesson to correspond to a single git commit, where the student can see exactly what code changed in the lesson by viewing the lesson's commit on GitHub.

What I'm not sure of is how to do this and make it maintainable so the commit history is always in sequence of the lessons. Or is there an alternative technique commonly used to do this that I'm unaware of (such as using branches/tags/patches)? My main concerns are:

  • Making corrections and updates to lessons/commits and ensuring these changes appear throughout the subsequent commits
  • Updating dependencies such as 3rd-party JavaScript libraries in any of the commits
  • Keeping the commit history in order, so that each commit is equal to one lesson and it appears in sequence. If the first commit/lesson is updated much later after it was originally committed, then it should still be the first entry in the commit log.

Guidance, suggestions, feedback, and improvements are all welcome, thanks in advance!

解决方案

Use branches - one branch for each lesson. So if you need to update the contents of a lesson afterwards, just make a commit in the lesson branch and, if needed, simply merge them to all following lesson branches.

Examples:

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 (rebasing, amending etc.) is usually not OK. Please do not show your students otherwise. The git commit log will help guide students much better if it will include and not hide all bug fixes, upgrade changes etc.

这篇关于使用git提交作为教程/研讨会步骤?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆