How do I update my git submodules from specific branches?

Matt

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.

VonC

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.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I list git branches with commits only to a specific directory?

How to merge specific files from Git branches

Git submodules development branches

git submodules in different branches

How do I fetch all Git branches?

GIT: How do I rebase nested branches?

How do I "git clone" a repo, including its submodules?

How do I `git add -u` except new commits in submodules?

How do I rebase a git superproject changing the hashes of the submodules?

How do I discard modified content in git submodules?

How do I update a branch taken from my local repository in git?

How can I strip .git files from submodules if submodules may have common parent directory?

Update Git branches from master

How to clone a git repository with its submodules checkout on their default branches?

Git submodule status - how to show current branches in submodules

How do I remove deleted Git branches from Visual Studio 2015

How to get all branches from git remote repository for a specific user

Git: How to list all branches that were created from a specific branch?

How to remove references to remote branches from my local git repository

How are different branches stored locally from git on my disk?

how do I update an app created manually from git in Openshift?

How do I exclude a git submodule from update using python?

Gradle update git submodules

Git update submodules recursively

How Do I Find A Specific Image From My Database

How do I update my dictionary with values from JSON?

Git - What happens to my local master branch after a pull request? How do I manage multiple in progress branches?

How do I deal with vim buffers when switching git branches?

How do Git branches work? Can I remove the master branch?