如何从特定分支更新我的git子模块? [英] How do I update my git submodules from specific branches?

查看:567
本文介绍了如何从特定分支更新我的git子模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Ruby on Rails应用程序,它有两个git子模块。我在主应用程序和两个子模块中将Rails从v3升级到v4,因此我为每个工作都创建了一个rails4分支。主应用程序和每个子模块都有自己独立运行的测试套件,因此我在子模块和项目中进行了升级,确保测试全部在每个地方运行,现在我需要将子模块更新到项目中。

I have a Ruby on Rails app that has two git submodules. I am upgrading Rails from v3 to v4 in the main app and in the two submodules, so I created a rails4 branch for each in which to do the work. The main app and each submodule have their own test suites that run independently, so I made the upgrades in the submodules and the project, ensured the tests all run in each place, and now I need to update the submodules into the project.

当我执行 git子模块更新时,如何在应用程序的rails4分支中告诉git从子模块的rails4分支进行更新。 ?可以暂时解决这个问题,因为我可以在应用程序确认正常工作并且分支机构全部合并到主服务器后将其指向主服务器。现在我需要将子模块更新到项目中。

How do I tell git in my app's rails4 branch to update from the submodules' rails4 branches when I do git submodule update? It's ok to have a temporary fix for this as I can point them back at master once the app is confirmed working and the branches all get merged in to master. Thanks.

推荐答案


b $ b

now I need to update the submodules into the project.

父回购仅记录SHA1(在特殊的 gitlink条目,模式160000

The parent repo only records SHA1 (in a special gitlink entry, mode 160000)

您可以在 rails4 分支中按顺序更新.gitmodules要求您的子模块检出/更新它们的 rails4 分支:请参阅 Git子模块:为整个过程指定一个分支/标记:它始于:

You can, in your rails4 branch, update your .gitmodules in order to ask your submodule to checkout/update their rails4 branch: see "Git submodules: Specify a branch/tag" for the full process: it starts with:

cd /path/to/your/parent/repo
git config -f .gitmodules submodule.<path>.branch <branch>

这将允许 git子模块更新--recursive --remote 更新这些子模块中的 rails4 分支。

That will allow for a git submodule update --recursive --remote to update the rails4 branch in those submodules.

这篇关于如何从特定分支更新我的git子模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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