Trying to figure out the right approach to using submodules in git
I'm trying to get a submodule setup properly in git and I want to make sure I use it right.
I have main repository called MyProject
. I have a secondary repository that contains all of our code generated data access called Data
. I want to setup Data
as a submodule of MyProject
.
Data
rarely changes unless there is a schema change, or a small little bug fix.
Let's say I'm adding some new functionality to MyProject
which requires a schema change. Typically I would create a branch of MyProject
called NewFeature
and check in all my changes there until it's ready to be merged with mas开发者_如何学运维ter. I also want to create a branch for Data
so that any schema changes stay seperate from Master
until my changes are ready to be merged.
What's the right workflow for this or is there even one?
Thanks!
Branches in a submodules are completely separate from branches from the parent repo.
Creating a NewFeature
feature branch on your parent repo doesn't mean you have to create the same in the submodule.
It only means that your parent repo will reference new commits from that submodule in the NewFeature
branch. The submodule commits can have been made in any branch (only defined in the submodule).
That being said, it is probably best to create also a NewFeature
in the subrepo, to establish some kind of naming convention enabling you to find highly coupled set of commits between your parent repo and your submodule.
(plus, as illustrated in the question "Git submodules: Specify a branch/tag", a submodule per se is always at first in a detached HEAD mode)
精彩评论