Magento & Subversion (SVN) - Getting a Development Environment Started?

Magento & Subversion (SVN) - Getting a Development Environment Started?

July 19, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento & Subversion (SVN) - Getting a Development Environment Started?

Managing Magento Development and Live Environments with SVN

Hello there! Let’s dive into how you can effectively manage your Magento development and live environments using Subversion (SVN) for version control.

Your Current Setup: A Solid Foundation

You’ve done an excellent job setting up the basics:

  1. You have a live site (mysite.com) hosted in ~/public_html/ on cPanel.
  2. Created a development subdomain (dev.mysite.com) pointing to ~/public_html/dev/.
  3. Established an SVN repository at ~/svn/ with folders for branches, tags, and trunk.
  4. Imported Magento v1.3.2.4 into the SVN trunk under trunk/magento.
  5. Set up two databases - mysite_live and mysite_dev.

The Challenge: Syncing Development and Live Environments

The key challenge you’re facing is syncing your development site with the live one while keeping certain environment-specific files separate, especially those in app/etc/local.xml and the database’s {{base_url}} value.

Step-by-Step Solution: Synchronizing Your Magento Sites

1. Initial Checkout and Installation

First, ensure that both your live and dev sites have the base Magento code from the SVN trunk:

# For development site (you've already done this)
cd ~/public_html/dev/
svn checkout file:///home/yoursite/svn/trunk/magento

# For live site
cd ~/public_html/
svn checkout file:///home/yoursite/svn/trunk/magento

Then, run the Magento installer on both sites to populate their respective databases.

2. Using SVN:ignore: The Key Ingredient

You’re on the right track thinking about using svn:ignore. This allows you to exclude certain files from being tracked by SVN, specifically environment-specific ones:

# Ignore local.xml in both sites
cd ~/public_html/magento/app/etc/
svn propset svn:ignore 'local.xml' .

3. Environment Variables: {{base_url}} and {{secure_base_url}}

Magento stores these values in the database, which can cause issues when migrating between environments. To keep them separate:

  1. Use different database tables for live and dev sites.
  2. Only update the non-environment-specific core_config_data records via SVN.

For example, you can sync everything except the URLs using a tool like MySQL Workbench to export/import data between databases, excluding the core_config_data table containing {{base_url}} and {{secure_base_url}} values.

4. Creating a Demo Branch: Simplified

To create a demo branch:

# In your SVN repository (~/svn/)
cd branches/
svn copy file:///home/yoursite/svn/trunk/magento file:///home/yoursite/svn/branches/demo

Then, check it out on your server:

# For demo site
cd ~/public_html/demo/
svn checkout file:///home/yoursite/svn/branches/demo

Conclusion: A Streamlined Magento & SVN Workflow

With this setup, you can:

  • Develop and test new features in dev.mysite.com.
  • Use SVN to version control your code.
  • Ignore environment-specific files with svn:ignore to keep them separate.
  • Sync databases (excluding specific tables) for easy deployment.

Remember, the key is keeping everything consistent except for what’s needed per environment. Using SVN properly allows you to manage changes effortlessly while maintaining a clean separation between your development and live Magento sites.

Happy coding! If you need more detailed guides or consulting on your project, feel free to reach out to Laravel Company. We’re always here to help!

This post was inspired by the question from Stack Exchange.

Checkout Database Configuration Import/Export

Our network