标记教程的步骤? [英] Tagging steps for a tutorial?

查看:97
本文介绍了标记教程的步骤?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个python和django教程,并将其与手中的练习结合起来。本教程将包含一系列要完成的任务:步骤1,步骤2,步骤2.2 ....如果我可以为练习创建git存储库并标记代表我的教程中的步骤的提交,那将是非常棒的。
如果这样做了,我可以跳到我的教程的任何一点,在练习中进行提交,并可以比较这些步骤,甚至跳过一些步骤。



我的第一个想法是:容易。
我的第二个想法:不是那么容易或很多工作。

例如:我可以用1,2, 2.2之后,我可以在我的git历史记录中找到所有步骤,标记它们并为每一步写下sha1。到现在为止还挺好。但是现在我想在第一步中改变一些东西。这一变化很重要,我希望在此之后的每一步都有这种变化。所以我必须重新标记每一步,因为我必须更新我所有的标签并获得新的sha1。



在正常的软件开发场景中,我只需要应用将hotfix添加到几个稳定的分支并标记新版本。在这里,我想改变现有的标签....也许有50个或更多。



现在有什么办法可以做到这一点,而不会因为标记而疯狂并用手重新包装所有东西?我可以编写软件来完成标记工作,但也许已经存在我不知道的东西?
Thanks!

解决方案

您可以为每个版本使用分支,而不是使用标签。例如,如果4基于你在2中做了什么,你可以从2创建一个分支,并将你的改变提交到4。 一个示例仓库:




$ b 创建 1 $ b / code> from master
  • 切换到 1

  • c $ c> git branch -d master

  • 创建并切换到 2 。 ( git checkout -b 2

  • 创建并切换到 2.1

  • 切换回 2

  • 创建并切换到 3


  • I want to write a python and django tutorial and combine this with hands on exercises. The tutorial will consist of a list of tasks to do: Step 1, Step 2, Step 2.2.... It would be awesome if i can create a git repository for the exercise and tag the commits which represent a step in my tutorial. If this is done, i am able to jump to any point in my tutorial, go the commit in the exercise and can compare the steps and even skip some steps.

    My first thought was: easy. My second thought: not so easy or a lot of work.

    For example: I can tag the repository with "1", "2", "2.2" after everything is done and i can find all the steps in my git history, tag them and write down the sha1 for every step. So far so good. But now i want to change something in my first step. This change is important and i want to have this change in every step after this. So i have to re-tag each step again because i have to update all my tags and will get new sha1s.

    In a normal software development scenario, i would just apply the "hotfix" to a couple of stable branches and tag new versions. Here, i want to change existing tags.... and maybe 50 or more of them.

    Is there any way for me now to do this without going insane with tagging and retagging everything by hand? I can write software to do the tagging job but maybe something already exists of what i am not aware of? Thanks!

    解决方案

    You could use a branch for every version, instead of using tags. If, for example "4" bases ond what you did in "2", you create a branch from "2" and commit your changes in "4".

    Here's an example repository:

    Steps to get this structure:

    • Created 1 from master
    • Switched to 1
    • Deleted master git branch -d master
    • Created and switched to 2. (git checkout -b 2)
    • Created and switched to 2.1.
    • Switched back to 2
    • Created and switched to 3

    这篇关于标记教程的步骤?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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