I'm working with GIT and Bitbucket. While working with Git Submodules i couldn't pull request at once all changes made in different submodules to the my main branch "MASTER". is there a way to create one pull request across many submodules.
Asked
Active
Viewed 1.0k times
1 Answers
5
Each time you are addin new commits (and pushing them) from your submodules, you are modifying the gitlink (a special entry in the parent repo index) representing the submodule tree SHA1.
You need to go back to that parent repo, add, commit and push those new gitlinks, before doing your PR from the branch you just pushed.

VonC
- 1,262,500
- 529
- 4,410
- 5,250
-
But this didn't answer the question of pull request, because if you haven't pushed the latest commit of a submodule, how could you approve the PR ? But the submodule can't be updated with a valid PR? Do you see the chicken and egg here? – windmaomao Apr 06 '23 at 01:22
-
@windmaomao the submodule is a different repository, which will follow its own process. As long as it commit is pushed, the parent repo can reference said commit, and follows its PR process. So: first make sure the submodule commit is pushed, with its own associated PR if needs be. Then the parent repo. – VonC Apr 06 '23 at 10:21
-
yes I understand this is the process. But this approach is based on a big assumption that the children PR for submodule can be pull requested and merged in independently without the knowledge of parent PR for supermodule. I don't see this assumption can be easily achieved. Because if so, it'll revert straight to the classical two individual repo cases. However, I do see the benefits of adding quick changes to both repos using submodule approach. I still think this is a bit hackish approach. My two cents only. – windmaomao Apr 07 '23 at 00:51
-
-
I have this same question, using Bitbucket Cloud in my case. I created a branch on my parent module, then created branches (from `master`) on my child modules, made some changes, committed and push the changes on my child modules, then committed and pushed the changes on my parent module. Now if I create a pull request on my parent module (the Git submodule) in Bitbucket, will it also create pull request for each child module with changes? – Chris F May 24 '23 at 15:05
-
@ChrisF I don't believe so: the submodule gitlink will be enough to reference the right SHA1 of each submodule, once your PR is accepted/merge in the parent module. But that PR only involve a parent module branch merge (from one branch to another), and should has no bearing on branches in each submodules. – VonC May 24 '23 at 15:38
-
@VonC, thanks. Yes I didn't expect this to work anywhere, not just Bitbucket. – Chris F May 24 '23 at 16:03