SVN: Magento Best Practice
Who: Anyone who works with Magento (especially clients who are running a store) and could benefit from a more in-depth understanding of Magento best practices. What: SVN and Magento (a sweet relationship) Why: Because whether you are a client or a developer, your life can be made easier by using SVN and reaping its benefits Quick Summary:
- High-level explanation of SVN
- Who should use SVN
- Why it should be used
- Specific things to watch out for with Magento
- Bonus: optional tools

1. A high-level explanation SVN
“SVN” (aka “Subversion”) changes and improves the development process. It is an “enhancement” to “CVS” which allows developers to maintain local, staging, and production environments. This is a best proactive for most software development (and Magento) projects. SVN relates to “Git” (though some prefer one more than the other) and is free to use. Simply put, SVN is a tool that keeps a revision history of code over a period of time. You keep project code located within the repository and pull a copy of the entire code with one simple command (a total of about 6 seconds). In addition, any updates to the code are committed to the repository, which allows anyone who is “linked” to the repository to sync their code with the latest changes via one click of a button. A simultaneous, multi-user environment is thus organized for development and proper administration. Just to reiterate - there are an incredible number of benefits to SVN… too many to mention here.2. Who should use SVN
Everyone who works with Magento should use SVN. As a rule of thumb, SVN should be used in any significant software development project (unless you use Git).3. Why SVN should be used
SVN allows multiple developers to build simultaneously in an organized fashion with a detailed history of the progress. This ensures that the live storefront (production environment) is always intricately cared for (read open for business). Every developer has experienced early on in their career the inevitable mistake of removing a file via FTP, only left to realize that file is lost in space and no longer retrievable. But large cocktails are no longer necessary to cope with such an event thanks to SVN. The developer’s life becomes easier; and the client’s business is safer. When used properly, SVN ensures reliability, integrity, speed, and fall-back recovery.4. Specific things to watch out for with Magento
In our experience, there are a few specifics to watch out for when using SVN with Magento. Without getting too technical, here are a few things we’ve learned along the way: You need to watch out for the caching within Magento. Utilizing SVN:Ignore is the key to allowing the local environment to cache correctly. I would recommend setting SVN to “ignore” for the following (at least) when maintaining separate environments:- app/etc/local.xml (or use SVN lock instead for this)
- media/catalog/product/cache
- var/
5. Bonus: optional tools
At Elias, we fancy apps that make our lives easier. We invest a lot of time researching and trying out new apps to see how well they fit our business. So far we have found a few SVN tools that are worth mentioning. (Note: these may be Apple-specific. Forgive us):- VersionsApp: A high-quality desktop application that allows one to manage repositories locally for streamlined management of code.
- BeanstalkApp: A sweet as online SVN storage service to host repositories full of code, revisions, and a great interface for management.
- Coda App: A quality code editor that integrates with SVN
- TextMate: Another quality code editor with SVN integration
- MAMP: A personal Mac server with Apache, Mysql and PHP
- VirtualHostX: A virtual hosting utility that works well with MAMP
- VirtualBox: A sweet virtualization product to run multiple operating systems
- Spoon.net: A browser-compatibility testing tool we’re just becoming familiar with