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. 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.
There's is typical .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
!
Instead import ext locally, install it locally and then commit and push ext's files and modified localconf.php
to remote server.
At the end of the localconf.php
include localconf_local.php
(ignored)
@include('localconf_local.php');
It will allow to override ie. credentials for DB, or custom ImageMagick
path without changing the original localconf.php
. Each dev in the team of course writes his own values to localconf_local.php
.
Typical TYPO3 folders ignored in .gitignore
should be created manually at each instance ie.
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.
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. 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.
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. If you use extensions, you will therefore use the latest version from the TER repository only. Extension configuration (typoscript setup, locallang values) will be placed in external files within 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.
Place .gitignore
where needed. We also ignore typo3conf/ext/
and typo3conf/l10n/
. Why? If we write our own extensions (or modify existing ones), we add the typo3conf/ext/my_extensionname/
to another repository. 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');
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With