Git在多个项目之间 [英] Git between multiple projects

查看:131
本文介绍了Git在多个项目之间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

项目特定文件位于应用程序文件夹中,引擎内容位于其他(system /,css /,index.php,..)。现在我想同步我的系统文件,这对所有项目都是一样的,但仍然会被编辑。那么如何在多个项目与GIT之间同步 images,js,css,system,index.php,.htaccess

我是git的新手,但我的第一个想法是在没有应用程序文件夹的情况下创建主(空)项目,然后我将从项目a切换到b,然后首先我会推送一个主项目,然后把它拉到b。也许可以通过php来完成。现在我已经做了一个PHP脚本,我将它包括到我的每个项目中,并且它同步,但它没有版本控制,而且速度很慢。我使用cookie通过浏览器存储上次使用的项目,如果该cookie发生更改,则同步所有项目。我想我可以通过 git exec()



有没有更好的解决方案?

解决方案

Git submodules (参见 Pro Git book )可能有助于:


  • 包含所有常用数据的父级回购

  • 一个称为应用程序的子模块回购,其中包含您的应用程序特定数据


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?

解决方案

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

这篇关于Git在多个项目之间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆