【问题标题】:git - develop base and extended feature - commits in base should reflect in extended in pullgit - 开发基础和扩展功能 - 基础中的提交应该反映在拉中的扩展中
【发布时间】:2019-08-05 04:42:43
【问题描述】:

嗨,我正在 git 中工作以实现如下所述的目标。

想象一下有一个大功能正在开发中——因为它非常大,它们分为核心功能和扩展功能。

现在他们已经分成团队进行开发。

现在如何用下面提到的方式制作分支

核心将在 core_branch 中开发 扩展将在包含核心开发的扩展分支中开发 应该是这样,当我们在extended_branch中执行git pull时,如果对core_branch有任何提交,它必须拉动如何实现这一点??

我知道 git rebase / git merge。在任何一种情况下,扩展团队/开发人员都必须检查核心分支中的任何新提交并合并/重新设置其扩展分支

【问题讨论】:

    标签: git github version-control development-environment


    【解决方案1】:

    这是一种方法:

    (1) 设置core_branch

    git checkout -b core_branch
    

    您可以正常开发并推送到core_branch

    (2) 查看基于core_branchextended_branch 分支。

    git checkout -b extended_branch # be sure to do this while on core_branch
    

    (3) 在extended_branch 上,如果你想从core_branch 拉取更改,请执行以下操作

    git fetch origin core_branch
    git rebase -i core_branch # do this while on extended_branch
    

    在这一步之后,所有对core_branch 的提交都将在extended_branch 上。

    【讨论】:

    • 我的回答也表达在*.com/questions/14893399/…
    • 每次更新 core_branch 时,您都需要手动检查。关键是你不会知道核心分支何时更新
    • 我不相信有办法获得自动更新。就像您需要手动拉出 master 一样,您需要手动拉出/rebase core_branch
    最近更新 更多