Github支行

Github subbranch

我目前正在为学校开展一个项目,我需要使用 git & github。我是 git 的新手,但知道提交、分支和推送的基本命令。

现在我的问题是,如何创建以下分支结构:

master | ---- branch_1 | ---- subbranch_1 ---- subbranch 2

我已经尝试了一些方法:首先,我遵循了您可以找到 here but all my branches where on the same hierarchical order. I also exactly followedthis 文章的指南,但我的分支再次处于同一水平。

谁能帮我解决这个问题。 先感谢您。

正如卡斯蒂斯在评论中所说。

首先git checkout master。这会将您置于 master 分支。

接下来,用 git checkout -b branch_1 创建 branch_1,这也会将您切换到 branch_1

您可以从那里创建 subbranch_1git checkout -b subbranch_1。但现在你在 subbranch_1...

因此,您需要返回 branch_1,按 运行 git checkout branch_1 这会让您进入 branch_1

从那里您可以创建 subbranch_2git checkout -b subbranch_2

您现在将在 subbranch_2