Git between multiple projects

混江龙づ霸主 提交于 2020-01-04 02:27:08

问题


I have multiple projects with directory structure like this:

/application/
/images/
/js/
/css/
/system/
index.php
.htaccess

Project specific files are in application folder, and "engine" stuff is in others(system/, css/, index.php, ..). Now i'd like to sync my system files, which are the same to all projects, but still will be edited. So how to sync images, js, css, system, index.php, .htaccess between multiple projects with GIT?

I'm new to git, but my first thought is to make master(empty) project, without application folder, and af i'll switch from project a to b, then first i'll push a to master project and then pull it to b. And maybe doing it via php. RIght now i have made a php script which i'll include to my every project and it doest the sync, but it has no versioning and is quite slow. I'm using cookie to store last used project by browser and if that cookie changes, then sync all projects. I guess i'll can to the same with git and exec().

Is there any better solution?


回答1:


Git submodules (See Pro Git book) might help with:

  • a parent repo with all your common data
  • a submodule repo called application, with your applciation specific data in it


来源:https://stackoverflow.com/questions/9256496/git-between-multiple-projects

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