What happens when a branch containing a submodule and a branch tracking a remote are merged?
Asked
Active
Viewed 104 times
1 Answers
1
Nothing special: a submodule is just an entry in the index, a gitlink.
As long as that entry (like a folder name) doesn't conflict with the same name from the other branch, the merge will proceed.
-
What do you mean by 'As long as that entry…doesn't conflict with the same name from the other branch?' Do you mean that such a merge will fail if there's a different file or folder with the same name in both branches? For example, say that I have two branches, one in which I have a folder and another in which there is a folder with the same name which is actually a sub-module. What would happen in this case? – RandomDSdevel Nov 29 '14 at 21:47
-
1A submodule is an folder entry. If you have the same folder name in the other branch (but not as a submodule), there will be a conflict (gitlink vs. plain folder): the merge will not proceed. – VonC Nov 29 '14 at 21:49
-
So I'd have to decouple the sub-module first. That stinks; I was hoping that there might be a way for the sub-module to be recognized as an exact duplicate of a specific point in the other branch's history and, as a result, get merged successfully. – RandomDSdevel Nov 30 '14 at 01:37
-
1@RandomDSdevel I confirm: a submodule is like a nested git repo: its content won't be inspected/compared with a similar content of the parent repo. – VonC Nov 30 '14 at 01:39
-
So I'd have to do something along the lines of the procedure outlined [here](http://x3ro.de/2013/09/01/Integrating-a-submodule-into-the-parent-repository.html) first before I merged the two branches. – RandomDSdevel Dec 01 '14 at 01:23
-
1@RandomDSdevel yes, if you want to include the history of the submodule in your parent repo. – VonC Dec 01 '14 at 07:04