How to Use SVN in Linux and Windows: Complete Beginner’s Guide

Subversion SVN version control guide for developers

Subversion (SVN) is a popular version control system used by developers to manage source code, track changes, collaborate with teams, and maintain different versions of software projects. Whether you are developing WordPress plugins, building websites, or working on application development, SVN helps you manage your project files efficiently.

If you are new to SVN, learning how to use it on Linux and Windows can make your development workflow much easier.

In this guide, we will explain how to install SVN, configure it, perform common version control operations, and use SVN to upload a WordPress plugin to the WordPress.org Plugin Directory.

What Is SVN (Apache Subversion)?

SVN, also known as Apache Subversion, is an open-source version control system that allows developers to manage and track changes in files and directories.

It maintains a central repository where project files and their revision history are stored. Developers can download project files, make changes, and upload updated versions to the repository.

Key Features of SVN

  • Version Control: Track every change made to your project files.
  • Centralized Repository: Store project files in a central location.
  • Revision History: View previous versions of files and folders.
  • Collaboration: Allow multiple developers to work on the same project.
  • Branching and Tagging: Maintain separate development versions and stable releases.
  • Conflict Management: Identify and resolve conflicts when multiple developers modify the same files.
  • File Management: Add, update, rename, move, and delete files.

1. How to Install SVN on Linux

SVN can be installed easily on Linux using your distribution’s package manager.

Install SVN on Ubuntu and Debian

Open your Linux terminal and execute:

sudo apt update
sudo apt install subversion -y

After installation, verify the SVN version:

svn --version

If SVN is installed correctly, the terminal will display the installed version.

Install SVN on Fedora

Use the following command:

sudo dnf install subversion -y

Verify the installation:

svn --version

Install SVN on Arch Linux

Execute:

sudo pacman -S subversion

Check the installed version:

svn --version

SVN is now ready to use on your Linux system.

2. How to Install SVN on Windows

Windows users can install SVN using a graphical interface or command-line tools.

One of the easiest options is TortoiseSVN.

Method 1: Install TortoiseSVN

TortoiseSVN is a Windows Shell extension that integrates SVN functionality into Windows File Explorer.

Installation steps:

  1. Visit the official TortoiseSVN website.
  2. Download the installer for your Windows architecture.
  3. Run the installer.
  4. Follow the installation instructions.
  5. Restart Windows if required.

Official website:

https://tortoisesvn.net

How to Use TortoiseSVN

After installation, open Windows File Explorer.

Right-click inside any folder to access the TortoiseSVN context menu.

You will find options such as:

  • SVN Checkout
  • SVN Update
  • SVN Commit
  • TortoiseSVN
  • Repo-browser
  • Check for Modifications

These options allow you to manage your SVN repository without using the command line.

Method 2: Install SVN Command-Line Tools

If you prefer working with PowerShell or Command Prompt, install an SVN command-line client such as SlikSVN.

Official website:

After installation, open PowerShell and execute:

svn --version

If the command is not recognized, check that the SVN installation directory is included in your Windows PATH environment variable.

3. Understanding SVN Repository Structure

An SVN repository stores project files and their revision history.

A common project structure looks like this:

my-project/
│
├── trunk/
│
├── branches/
│
└── tags/

Let’s understand each directory.

Trunk: Contains the main development version of your project.

Branches: Contains separate development versions used for new features, testing, or experimental changes.

Tags: Contains stable versions or releases of your project.

For example:

my-project/
│
├── trunk/
│   ├── index.php
│   ├── style.css
│   └── functions.php
│
├── branches/
│   └── development/
│
└── tags/
    ├── 1.0.0/
    ├── 1.0.1/
    └── 1.1.0/

This structure makes it easier to maintain different versions of your software.

4. How to Checkout an SVN Repository

Checkout downloads a working copy of an SVN repository to your local computer.

On Linux

Open the terminal and navigate to your project directory:

cd ~/projects

Execute the checkout command:

svn checkout https://example.com/svn/my-project

SVN will download the repository files into your local directory.

You can also specify a local folder name:

svn checkout https://example.com/svn/my-project my-project

On Windows Using TortoiseSVN

  1. Create a folder where you want to store your project.
  2. Right-click the folder.
  3. Select SVN Checkout.
  4. Enter the repository URL.
  5. Select the checkout directory.
  6. Click OK.

TortoiseSVN will download the repository files.

On Windows Using Command Line

Open PowerShell:

cd C:\Projects

Run:

svn checkout https://example.com/svn/my-project

Your repository is now available locally.

5. Important SVN Commands Every Developer Should Know

Here are the most commonly used SVN commands for managing project files.

1. Check Repository Status

To see which files have been modified, added, or deleted:

svn status

Common status indicators:

SymbolMeaning
AAdded file
MModified file
DDeleted file
?Untracked file
!Missing file
CConflict

2. Update Your Local Repository

To download the latest changes from the central repository:

svn update

This keeps your local working copy synchronized with the repository.

3. Add New Files

To add a new file:

svn add filename.php

To add an entire directory and its contents:

svn add --force my-folder

4. Commit Changes

After modifying files, upload your changes to the SVN repository:

svn commit -m "Updated project files"

SVN may ask for your repository username and password.

5. Delete Files

To remove a tracked file:

svn delete filename.php

To commit the deletion:

svn commit -m "Removed unused file"

6. Rename Files

Use the SVN move command:

svn move old-file.php new-file.php

Commit the change:

svn commit -m "Renamed file"

7. View Revision History

To see the commit history:

svn log

To see detailed information about a particular revision:

svn log -r 100

Replace 100 with your revision number.

8. Revert Changes

If you want to discard uncommitted changes to a file:

svn revert filename.php

To revert changes throughout a directory:

svn revert -R .

Warning: Reverting removes local modifications. Back up any changes you want to preserve before running this command.

9. Compare File Changes

To view differences between your local file and the repository version:

svn diff

To compare a specific file:

svn diff filename.php

10. Check Repository Information

To view information about your working copy:

svn info

This displays the repository URL, revision number, working copy root, and other details.

6. How to Create Branches and Tags in SVN

Branches and tags help developers manage multiple versions of a project.

Create a Branch

To create a development branch:

svn copy trunk branches/new-feature -m "Created new feature branch"

Switch to a Branch

svn switch https://example.com/svn/my-project/branches/new-feature

Create a Tag

To create a stable release:

svn copy trunk tags/1.0.0 -m "Release version 1.0.0"

Tags preserve a snapshot of the project at a particular revision.

7. How to Use SVN to Upload a WordPress Plugin

WordPress.org uses SVN to manage plugin source code, releases, banners, icons, and screenshots.

If you are developing a WordPress plugin and want to publish it in the official WordPress Plugin Directory, you can use SVN to upload your plugin.

Step 1: Get Your WordPress.org SVN Repository URL

After your plugin submission is approved, WordPress.org provides an SVN repository URL.

It follows this format:

https://plugins.svn.wordpress.org/your-plugin-slug/

Replace your-plugin-slug with your actual plugin directory slug.

Step 2: Checkout the Plugin Repository

On Linux:

cd ~/projects

Execute:

svn checkout https://plugins.svn.wordpress.org/your-plugin-slug/

Enter the repository directory:

cd your-plugin-slug

Step 3: Understand the WordPress Plugin Directory Structure

WordPress.org uses the following structure:

your-plugin-slug/
│
├── assets/
│   ├── banner-772x250.png
│   ├── banner-1544x500.png
│   ├── icon-128x128.png
│   ├── icon-256x256.png
│   ├── screenshot-1.png
│   └── screenshot-2.png
│
├── trunk/
│   ├── your-plugin.php
│   ├── readme.txt
│   ├── uninstall.php
│   ├── includes/
│   ├── admin/
│   └── public/
│
├── branches/
│
└── tags/

Important: The plugin source code belongs inside trunk, while plugin directory images belong inside the root-level assets folder.

Step 4: Copy Your Plugin Files into Trunk

Copy your plugin files into the trunk directory.

For example, on Linux:

cp -a ~/Downloads/my-plugin/. trunk/

Make sure the main plugin PHP file and readme.txt are directly inside trunk.

Step 5: Add Files to SVN

Run:

svn add --force trunk
svn add --force assets

Check the status:

svn status

Step 6: Commit Your Plugin

Upload the files to WordPress.org:

svn commit -m "Initial release of my WordPress plugin"

Enter your WordPress.org SVN credentials when prompted.

Step 7: Create a Plugin Release

Update the version number in your main plugin PHP file and the Stable tag in readme.txt.

For example:

Version: 1.0.0

In readme.txt:

Stable tag: 1.0.0

Create the release tag:

svn copy trunk tags/1.0.0

Commit the release:

svn commit -m "Release version 1.0.0"

Your plugin release is now tagged in SVN.

For more information, visit the official WordPress documentation:

8. How to Use SVN on Windows for WordPress Plugin Uploads

You can also publish WordPress plugins using TortoiseSVN on Windows.

Follow these steps:

Step 1: Create a local folder for your plugin repository.

Step 2: Right-click the folder and select SVN Checkout.

Step 3: Enter your WordPress.org SVN repository URL.

Step 4: Copy your plugin source files into the trunk directory.

Step 5: Copy your banner, icon, and screenshots into the assets directory.

Step 6: Right-click the repository folder and select TortoiseSVN → Add.

Step 7: Select the files and confirm.

Step 8: Right-click the repository folder and select SVN Commit.

Step 9: Enter a commit message and click OK.

To create a release, right-click trunk, select TortoiseSVN → Branch/Tag, and set the destination to:

/tags/1.0.0

Choose the appropriate copy-from-working-copy option, confirm the operation, and commit if needed.

9. Common SVN Errors and Their Solutions

While working with SVN, developers may encounter several common errors.

Error 1: Authentication Failed

Possible reasons:

  • Incorrect username or password.
  • Invalid repository permissions.
  • Incorrect authentication credentials.

Solution:

Verify your credentials and confirm that you have permission to access the repository.

Error 2: Working Copy Locked

This error can occur if an SVN operation was interrupted.

Try:

svn cleanup

Then run:

svn update

Error 3: Out of Date

This happens when another user has committed changes before your commit.

Solution:

svn update

Resolve any conflicts and commit again.

Error 4: File Already Exists

This may happen when trying to add a file that SVN already tracks.

Check:

svn status

If the file is already tracked, modify it and commit instead of adding it again.

Error 5: Tree Conflict

A tree conflict occurs when SVN cannot automatically reconcile structural changes, such as a file being renamed or deleted by another developer.

Use:

svn status

Identify the conflicting files, inspect the changes, resolve the conflict, and mark it resolved:

svn resolve --accept working filename.php

Only use this option after verifying that your working copy contains the correct version.

10. Best Practices for Using SVN

Follow these practices to maintain a clean and organized repository:

  1. Commit changes regularly.
  2. Use meaningful commit messages.
  3. Always run svn update before starting work.
  4. Check svn status before committing.
  5. Avoid uploading temporary and unnecessary files.
  6. Use branches for experimental development.
  7. Use tags for stable releases.
  8. Resolve conflicts carefully.
  9. Maintain backups of important project files.
  10. Test your code before committing production releases.

Conclusion

SVN is a useful version control system for developers who want to manage source code, track project changes, and maintain stable software releases.

Whether you use Ubuntu, Debian, Fedora, Windows, or another supported operating system, SVN provides a consistent workflow for managing projects.

Linux users can work directly through the terminal, while Windows users can choose between command-line tools and the convenient TortoiseSVN graphical interface.

For WordPress developers, SVN is particularly important because it is the standard system used to publish and maintain plugins in the official WordPress.org Plugin Directory.

Learning the essential SVN commands will help you manage your development projects more efficiently and publish software with confidence.

Have a project in mind?

Tell us what you want to build. We will reply with next steps and an estimate.