I have a repository that I am using which has three submodules. So when I cloned it I did git clone --recurse-submodules ProjectA.git
Among this "project A"'s submodules there is "Project B" which I found is faulty (some problem with its dockerfile etc- not really related to this question).
So I created a branch in ProjectB and I corrected its fault. Now I have tried it independently and it seems to work fine.
Of course the ideal thing would be to request to merge it to the main branch but I am not looking forward to it soon.
So, my question is , how can I make that ProjectA use ProjectB's FeatureBranch (that I created) in its submodules, so that it can run correctly?
Right now, I am assuming the submodules all use their main branch .
Submodules in Git are essentially pointers to specific commits in another repository. They don't automatically track branches, but you can set them to point to any commit on any branch you want, including your custom FeatureBranch
.
cd ProjectA/ProjectB
git fetch origin
git checkout FeatureBranch
cd ..
git add ProjectB
git commit -m "Update ProjectB submodule to FeatureBranch"
git push