简体   繁体   English

GIT 向主要产品分支添加更改

[英]GIT add changes to a main product branch

We have a product repo which refers to many submodules - say:我们有一个产品仓库,它引用了许多子模块——比如:

product->document
       ->examples
       ->code
etc

Now I have made changes to "code" repo.现在我对“代码”存储库进行了更改。 So my changes goes to "code" repo / develop and its build goes fine.所以我的更改转到“代码”回购/开发并且它的构建正常。 Note that my changes however is yet to be merged in "code" repo develop branch请注意,我的更改尚未合并到“代码”回购开发分支中

Now I am in need to build 'product' repo with my modified 'code' submodule such that I can check our changes in an environment - note only "product" repo creates product executable.现在我需要使用我修改过的“代码”子模块构建“产品”存储库,以便我可以检查环境中的更改 - 请注意只有“产品”存储库创建产品可执行文件。 The "product" repo refers to submodules develops branch. “产品”存储库指的是子模块开发分支。 Hence until my code is delieverd to "code" develop branch I am unable to build a "product" build with my changes.因此,在我的代码被交付到“代码”开发分支之前,我无法使用我的更改构建“产品”版本。

In other words the "product" repo needs to be build that points to the my "code" submodule.换句话说,需要构建指向我的“代码”子模块的“产品”存储库。

I tried below way - checkout a "product" branch and tried to cherry-pick / merge changes in "code" repo to have my code repo changes:我尝试了以下方式 - 签出“产品”分支并尝试挑选/合并“代码”存储库中的更改以更改我的代码存储库:

user$ /c/product> git checkout -b feature/test_my_code_changes

user$ /c/product> (feature/test_my_code_changes)
$ git cherry-pick 44b591ca3266ad54d7c09c7dd55d2b65501a4077
fatal: bad object 44b591ca3266ad54d7c09c7dd55d2b65501a4077


user$ /c/product> (feature/test_my_code_changes)
$ git merge 44b591ca3266ad54d7c09c7dd5654323401a4077
merge: 44b591ca3266ad54d7c09c7dd5654323401a4077 - not something we can merge

The above command fails - I believe that cause the commit ids belongs to "code" submodule of my changes - how can I achieve the objective and verify that my "product" repo is refering or having my submodule / changes and then start a "product" build?上面的命令失败 - 我相信提交 ID 属于我更改的“代码”子模块 - 我如何实现目标并验证我的“产品”存储库是否引用或具有我的子模块/更改,然后启动“产品” “ 建造?

You could make the submodule code follows the branch used before merfing to develop in your product repository.您可以使子模块code遵循在 merfing 之前使用的分支在您的product存储库中进行develop

That way, a simple git submodule update --remote would be enough to force a pull of the develop branch in submodule code .这样,一个简单的git submodule update --remote就足以强制拉取 submodule code中的develop分支。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM