Warm tip: This article is reproduced from serverfault.com, please click

git-用特定的子仓库分支创建顶级仓库仓库分支

(git - Create top repo branch with specific subrepo branches)

发布于 2020-12-03 15:01:54

拥有一个由一个顶级仓库和几个子仓库组成的git基础设施。然后,我们有了Jenkins基础架构,该基础架构采用了特定的顶级仓库分支来在其上执行管道。

现在,我已将代码提交并推送到子仓库之一中的自定义分支。

自然,我想用我的自定义代码测试jenkins管道,而不必先合并到master或先进行开发。

因此,如何创建一个顶部存储分支,该分支在所有存储库中(通常是开发中)包含默认分支,除了我处理过的那个存储库外,应该在其中签出我的自定义分支?

Questioner
AlexGeorg
Viewed
11
LeGEC 2020-12-03 23:21:29

除非我缺少什么,否则它只是一个常规分支:

# starting from top repo :
git checkout -b newbranch

cd subrepo/
git fetch
git checkout <target branch> # or git merge, or edit files and commit+push,
                             # or anything ...

# go back to your top repo, and commit this new state :
git add subrepo
git commit