简体   繁体   English

如何使用git最好地管理TYPO3安装?

[英]How best to manage TYPO3 installations using git?

Hello I have been meaning to get around to this for a while now, but I would like to use git to maintain some typo3 development sites. 您好,我已经有意义暂时解决这个问题,但我想使用git维护一些typo3开发网站。 I did some digging around and the most informative ( chromium translated site ) info on the subject isn't clear but did make me think. 我做了一些挖掘,关于这个主题的最丰富的( 铬翻译网站 )信息不明确,但确实让我思考。 I'd like to know how to setup a git managed repo and if there are some/other folders that I should ignore when setting up the repo, what I should be wary of, best practices, etc. I have decided that with each version, a db dump would be done separately which corresponds with the milestone because as of now I'm not sure how to deal with this aspect of CMS versioning. 我想知道如何设置一个git托管仓库,如果有一些/其他文件夹,我应该在设置回购时忽略,我应该警惕,最佳做法等等。我已经决定每个版本,数据库转储将单独完成,与里程碑相对应,因为截至目前我不知道如何处理CMS版本控制的这一方面。

There's is typical .gitignore 这是典型的.gitignore

/fileadmin/user_upload/
/fileadmin/_temp_/

/uploads/

/typo3conf/temp_CACHED*
/typo3conf/temp_fieldInfo.php
/typo3conf/localconf_local.php

/typo3/
/t3lib/
/typo3temp/

Keep in mind that when using TYPO3 with git you should not install any extension on the remote with Extension Manager ! 请记住,当使用带有git TYPO3 ,不应使用Extension Manager在遥控Extension Manager上安装任何扩展!

Instead import ext locally, install it locally and then commit and push ext's files and modified localconf.php to remote server. 而是在本地导入ext,在本地安装它,然后提交并推送ext的文件并将localconf.php修改为远程服务器。

At the end of the localconf.php include localconf_local.php (ignored) localconf.php包括localconf_local.php (忽略)

@include('localconf_local.php');

It will allow to override ie. 它将允许覆盖ie。 credentials for DB, or custom ImageMagick path without changing the original localconf.php . DB的凭据,或自定义ImageMagick路径,而不更改原始localconf.php Each dev in the team of course writes his own values to localconf_local.php . 团队中的每个开发人员当然都将自己的值写入localconf_local.php

Typical TYPO3 folders ignored in .gitignore should be created manually at each instance ie. .gitignore忽略的典型TYPO3文件夹应该在每个实例上手动创建,即。

typo3temp

fileadmin/user_upload

Of course you need also download TYPO3 sorces ( typo3 , t3lib folders) - there is no bigger sense to keep them under version control. 当然你还需要下载TYPO3 sorces( typo3t3lib文件夹) - 将它们置于版本控制之下没有更大的意义。

Other things, like uploads should be downloaded manually from the remote, so it's best to write a script which will pack it and every developer will have possibility to download it with some link. 其他内容,如uploads应该从远程手动下载,所以最好编写一个脚本来打包它,每个开发人员都可以通过一些链接下载它。 You can't add this to git repo as these files are just created while creating the content element, so if you won't ignore them you risk a huge merging conflict soon. 你不能将它添加到git repo,因为这些文件只是在创建内容元素时创建的,所以如果你不忽略它们,你很快就会面临巨大的合并冲突。

I'd like to add some aspects to biesiors very good answer: From my experience, the best strategy is to put fileadmin/ and typo3conf/ under version control, and nothing else at first. 我想为biesiors添加一些非常好的答案:从我的经验来看,最好的策略是将fileadmin/typo3conf/置于版本控制之下,而不是其他任何东西。 If you use extensions, you will therefore use the latest version from the TER repository only. 如果您使用扩展,则仅使用TER存储库中的最新版本。 Extension configuration (typoscript setup, locallang values) will be placed in external files within fileadmin/. 扩展配置(typoscript设置,locallang值)将放在fileadmin /中的外部文件中。 Example folder structure: 示例文件夹结构:

fileadmin/
- css/
- images/
- javascript/
- scripts/
- templates/
- - html/
- - templavoila/
- - typoscript/
- - xml/

Do not store any typoscript information in the database - it cannot be versioned from there. 不要在数据库中存储任何typoscript信息 - 它不能从那里进行版本控制。

Place .gitignore where needed. 在需要的地方放置.gitignore We also ignore typo3conf/ext/ and typo3conf/l10n/ . 我们也忽略了typo3conf/ext/typo3conf/l10n/ Why? 为什么? If we write our own extensions (or modify existing ones), we add the typo3conf/ext/my_extensionname/ to another repository. 如果我们编写自己的扩展(或修改现有的扩展),我们将typo3conf/ext/my_extensionname/到另一个存储库。 This way, the extension itself can be well maintained, especially if used in multiple projects. 这样,扩展本身可以很好地维护,特别是如果在多个项目中使用。 And unchanged extensions do not need to be versioned at all. 并且不需要对未更改的扩展进行版本控制。

Follow the @include('localconf_local.php'); 关注@include('localconf_local.php'); suggestion - this is good practice. 建议 - 这是一种很好的做法。

This setup adds a higher demand on coding discipline, but you will be rewarded! 此设置对编码规则提出了更高的要求,但您将获得奖励! We have been successfully working like that for more then 12 projects now in a team of two. 我们已经成功地为这样的团队工作了12个以上的项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM