Question

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.

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.

Was it helpful?

Solution

now I need to update the submodules into the project.

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

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>

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top