Using GIT with Joomla [closed]
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this questionWe are a web design company, going down the road of setting up a revision management system, and all the processes around how we are going to use it, etc. We are considering using the git revision management system.
We mainly develop our websites on the Joomla! Content Management System (CMS). I would like to know how other companies manage their repositories when dealing with a CMS. We mainly deal with template building, and we occasionally customise components or plugins we have installed.
My main questions are:
- Is the best way to store all files (including the Joomla files) in the repository, or just files that you make or change yourself?
- Do you keep a copy of the database (which Joomla uses for its operation and content storage) somewhere, to account for database changes?
I know this question has already got an accepted answer but maybe someone will come back to this and find it useful.
- I think tracking entire joomla and trying to exclude core files is almost impossible and as @vicgilbcn says it can become a nightmare.
- On the other hand if you are developing a component for J! which 'unfortunately' is slipt in 'components/com_mycomp', 'administrator/components/com_mycomp' and probably 'media/com_mycomp' you should have 3 separate git repos to track it - so this is not viable either.
So what I came up with and seems to be working quite well, is this: Let's say I have a normal J! deloyment with my com_mycomp component inside.
- I create a folder outside of the joomla codebase and call it "COMMON".
- in "COMMON" I create a "joomla" folder
- in "COMMON/joomla" I create "myComp" folder which will hold entire codebase of my component
- in "COMMON/joomla/myComp" I use the Joomla folder structure and I MOVE(not copy) 'components/com_mycomp', 'administrator/components/com_mycomp' and 'media/com_mycomp' inside it.
- then i go back to where I removed the folders from and create symlinks to the new locations.
This way a can now create a git repository in COMMON/joomla/myComp.
Obviously, this environment should be a local development environment where you can adjust apache/php configuration, without security implications, to make this work. (I cannot recall if I actually had to do any special configuration modifications for this to work - if it doesn't check the logs...)
As a matter of fact, this solution does resolve another problem. Working this way you can actually symlink your component's codebase folders to two different Joomla deployments (a J!2.5.x and a J3.x.x for example) and be able to develop/check your component compatibiliy in an immediate way against different versions.
This article by Joe LeBlanc is one of the few things I've found regarding Revision Control in Joomla!: http://joomlaablog.blogspot.it/2010/11/how-to-track-your-joomla-project-with.html
There are two general strategies you can employ for using Git with Joomla: either track the entire Joomla installation or track a specific extension. The major deterrent to tracking Joomla itself with Git is the sheer size of the Joomla codebase. While Git is reasonably fast, it can still be overkill to track an entire Joomla installation if you’re adding a single template or module.
On the other hand, putting everything into Git makes it possible to determine when patches were applied to the Joomla site. This can be helpful when you’re trying to trace an issue to a specific patch. Also, if you’re creating a number of extensions that are all designed to work together, you may have no choice but to place the entire site under version control.
If you’re working on a single extension and you know it’s the only one that will be a part of a project, it may be more advantageous to track a single directory. A single frontend only component, backend only component, module, or template are all candidates for being tracked separately from a Joomla installation. It’s difficult to track plugins in this way, due to the fact that plugin .php files are placed side-by-side in shared folders. Tracking complete components this way is also problematic, as changes in the backend can affect behavior in the frontend.
For your first question, usually most groups will check in all files related to projects (excluding logs and temporary files). If you do want to store your database, store a dump of the database (and not the binary files). You should be sure to include both the data and schema.
If you decide for the first option (track the whole joomla) you have to .gitignore all the core and every time an external extension is added. Otherwise is a nightmare when someone installs an extension and commits it. Then you have to discover it after pulling and sometimes it doesn't work. Also the version Joomla changes are difficult to manage.
I advocate for different repositories to different extension, but I'm still looking for a way to have one repo to a whole component (admin+front+install). Any idea (submodules or subtree mergin perhaps) ?
We are in a similar situation to you - design agency with Joomla sites.
We use Subversion, with each website as a repository. When we start a project, we download the latest version of Joomla and place it in SVN. We then check out the site from SVN to a local machine and work on it, checking in when required.
精彩评论