Multiple projects with same GIT master

谁说我不能喝 提交于 2020-01-24 09:04:43

问题


In our development environment we have a custom framework. While all our projects start with the base it is extended on a project by project base with the use of plugins and themes.

The folder structure is:

  • core (Contains shared code between all projects)
  • plugins (Each subfolders of is a plugin, some exist in all projects, some are project specific)
  • themes (Contains project specific only code)

Currently we clone our master repo delete the .git folder, create a new repo and go about our changes. If a feature or bug is fixed in a project or the main repo, we currently manually merge changes with various diff tools (winmerge mainly) to ensure that project specific themes or plugins don't get in to the master repo and that all project have the latest core and shared plugins.

I know there must be a better approach to this, using sub modules perhaps? core as a sub module, each plugin as a sub module and each theme as a sub module? Then each project being its own repo?

Or is the structure not the best for this setup?


回答1:


Use of a sub module named PLUGIN for plugin in a git repo named PROJECT allow that this repos point to a specific version of the plugin. So if the plugin evolve in its own repos, the developer of PROJET will have to go in the plugin directory in PROJECT repo and issue a

git pull

to get it. It can be usefull to work only with stable version of plugins, while they're developed.

Furthermore the source history of the plugin is only managed in its own repo. It's a development scheme easier to understand.

Use submodule is also usefull when you have repo containing use sets of binary/data, with heavy history management. So it won't slow down your other repos.




回答2:


Use differents repositories for your core project and your inherited projects. All your inherited project should include your skeleton project as dependancy, maven allow you to deal with that.

Every single time you update your structure, you have just to update your dependancies on each projects, no more tricky merge



来源:https://stackoverflow.com/questions/19356630/multiple-projects-with-same-git-master

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!