Scope & Applicability. Applicable to Apache Subversion (SVN) versions 1.8 through 1.14+ (LTS). In command examples, <path> or <url> denote placeholders; ^/ represents the repository root URL.
Apache Subversion is a centralized version control system (CVCS) built upon monotonic integer revisions and directory-tree snapshots. This cheat sheet consolidates daily commands, branching/merging conventions, status code definitions, and repository administration.
🔗 Related Version Control & CLI Cheat Sheets: Git Cheat Sheet · Linux Commands · Bash Cheat Sheet
1. Tool Components & URL Schemes
Core Command-Line Utilities
| Utility | Description & Primary Function | Typical Use Case |
|---|---|---|
svn |
Core client command-line binary | Daily checkouts, file modifications, commits, branching, diffs, and status inspection |
svnversion |
Extracts the composite revision summary of the working copy | Injects build version strings into automated build and CI/CD pipelines |
svnadmin |
Server-side repository administration tool | Repository creation, hot backups, dump streams, restoration, and database verification |
svnlook |
Read-only inspection utility for server-side repositories | Pre-commit inspection inside server-side hook scripts |
svnsync |
Unidirectional incremental repository mirroring tool | Offsite disaster recovery backups, read-only slave mirrors |
svnrdump |
Remote repository dump and load utility | Network-level dump operations without direct server filesystem permissions |
svndumpfilter |
Stream filter for repository dumpfiles | Pruning paths or splitting multi-project repositories during migrations |
svnserve |
Standalone custom SVN protocol daemon | Lightweight local network or private on-premise hosting |
mod_dav_svn |
WebDAV module for Apache HTTP Server | Enterprise HTTPS hosting with LDAP/SSO authentication |
Repository Access URL Schemes
| URL Scheme | Description & Transport | Default Port / Example Path |
|---|---|---|
file:// |
Direct local filesystem or mounted NFS share | file:///var/svn/repos/project |
http:// |
WebDAV over plaintext HTTP | Port 80 (Unencrypted) |
https:// |
WebDAV over TLS/SSL encryption | Port 443 (Production standard) |
svn:// |
Native binary protocol via svnserve |
Port 3690 (High-performance TCP) |
svn+ssh:// |
Custom svnserve tunneled through an encrypted SSH channel |
Port 22 (Secure, no extra ports required) |
2. Working Copy Checkout, Update & File Management
Checkout & Update
# Check out a remote repository into the current or specified directory
svn checkout <url> [target_dir]
svn co <url> [target_dir]
# Update the working copy to the latest HEAD revision
svn update
svn up
# Update working copy to a specific revision (e.g. revision 42)
svn update -r 42
# Update only a specific file or subdirectory
svn update path/to/file_or_dir
# Control checkout depth (--depth: empty | files | immediates | infinity)
svn update --set-depth immediates
Adding & Reverting Changes
# Schedule a new file or directory for addition
svn add <path>
# Recursively add all unversioned files under the current directory (respects svn:ignore)
svn add *
# Force recursive addition of untracked files inside existing versioned trees
svn add * --force
# Revert local uncommitted modifications on a specific file (restores BASE revision)
svn revert <path>
# Revert all local uncommitted changes recursively across the entire project
svn revert -R .
svn revert --depth infinity .
3. Committing Changes & Importing
Committing (Commit)
# Commit modifications with an inline log message
svn commit -m "feat: implement user authentication" <path>
svn ci -m "fix: resolve null pointer exception"
# Read commit log message from a text file
svn commit -F log_message.txt
# Non-recursive commit (submits only top-level directory property changes)
svn commit --depth files -m "chore: update root configuration"
Importing Unversioned Trees (Import)
# Import an unversioned local directory directly into the repository (does not create a working copy)
svn import /local/path/to/project <url>/trunk -m "Initial import of legacy codebase"
4. Status Inspection & Complete Status Code Matrix
Inspecting Status
# Inspect local working copy status
svn status
svn st
# Display status including unversioned ignored files
svn status --no-ignore
# Check against the remote repository for outdated files requiring an update
svn status -u
svn st -u -q
svn status Column Code Meanings
The output of svn status comprises 7 character columns followed by the item path.
Column 1: File Content Status
| Code | Status Meaning | Explanation |
|---|---|---|
|
Normal | The file is identical to the repository BASE revision |
A |
Added | The item is scheduled for addition on the next commit |
D |
Deleted | The item is scheduled for deletion on the next commit |
M |
Modified | The text contents of the file have been modified locally |
R |
Replaced | The item was deleted and replaced by an item with the same name |
C |
Conflicted | The file contains an unresolved merge conflict |
X |
External | The item is an unversioned directory managed by svn:externals |
I |
Ignored | The file matches an svn:ignore or global ignore pattern |
? |
Unversioned | The file is not under version control |
! |
Missing | The file is under version control but missing on disk |
~ |
Obstructed | An object of a different type occupies the path of a versioned item |
Columns 2–7: Properties, Locks & History
| Column Position | Code | Meaning |
|---|---|---|
| Col 2: Properties | |
Normal properties |
M |
Properties have been modified locally | |
C |
Property conflict exists | |
| Col 3: Working Lock | |
Normal directory |
L |
Working copy directory is locked by a background process (run svn cleanup) |
|
| Col 4: History | |
Normal item |
+ |
Scheduled for addition with history (copied or moved) | |
| Col 5: Switch | |
Normal item |
S |
Item is switched to a different branch relative to its parent | |
| Col 6: Lock Token | |
Normal item |
K |
File has a local lock token | |
O |
File is locked by another user in the remote repository | |
| Col 7: Tree Conflict | |
Normal item |
C |
Tree conflict exists on this path |
5. History, Diffs & Blame
# View recent commit logs
svn log -l 10
# View detailed logs including changed file paths
svn log -v -r 100:105
# Compare working copy against the repository BASE revision
svn diff
# Compare differences between two specific revisions
svn diff -r 40:42
# View line-by-line author attribution (Blame / Annotate)
svn blame path/to/file
svn annotate path/to/file
6. Branching, Tagging & Merging
Subversion standard directory layout:
^/trunk: Active mainline development^/branches: Isolated feature and release branches^/tags: Immutable snapshot releases
# Create a feature branch (cheap server-side copy)
svn copy ^/trunk ^/branches/feature-auth -m "Create feature branch for auth overhaul"
# Switch working copy to the feature branch
svn switch ^/branches/feature-auth
# Merge trunk changes into your feature branch (sync merge)
svn merge ^/trunk
# Reintegrate feature branch back into trunk (executed from trunk working copy)
svn merge --reintegrate ^/branches/feature-auth
7. Conflict Resolution & File Locking
# Resolve conflicts interactively
svn resolve path/to/conflicted_file
# Resolve non-interactively using predefined strategies:
# Accept local modifications:
svn resolve --accept mine-full path/to/file
# Discard local modifications and accept incoming repository version:
svn resolve --accept theirs-full path/to/file
# Accept locally edited working file:
svn resolve --accept working path/to/file
# Clean up stale locks after an interrupted command
svn cleanup
# Lock an unmergeable binary file exclusively (PSD, 3D model, Excel)
svn lock design/banner.psd -m "Editing banner assets"
# Release lock
svn unlock design/banner.psd
8. Property Management (Properties)
# List all properties defined on a path
svn proplist [path]
# Read a specific property value
svn propget svn:ignore .
# Set a property value
svn propset svn:executable ON script.sh
# Edit multiline property in default editor
svn propedit svn:ignore .
# Remove a property
svn propdel svn:ignore .
Common Standard Properties
| Property | Purpose | Example |
|---|---|---|
svn:ignore |
Directory-level newline-delimited ignore patterns | node_modules, *.log, target/ |
svn:global-ignores |
Inheritable global ignore patterns (1.8+) | Set at root to apply across entire subtree |
svn:executable |
Sets executable permissions on checkout | svn ps svn:executable ON run.sh |
svn:eol-style |
Cross-platform line-ending translation | native, LF, CRLF |
svn:keywords |
Expands revision keywords inside files | Id Date Revision Author ($Id$) |
svn:externals |
Mounts external repositories or directories | vendor/lib ^/subprojects/lib@200 |
9. Server Administration (svnadmin)
svnadmin runs locally on the host filesystem where repositories reside:
| Command | Description | Typical Execution |
|---|---|---|
svnadmin create |
Initializes a new SVN repository | svnadmin create /var/svn/repo |
svnadmin dump |
Exports full or incremental repository dump stream | svnadmin dump /var/svn/repo > backup.dumpsvnadmin dump /var/svn/repo -r 100:200 --incremental > delta.dump |
svnadmin load |
Restores a dump stream into a target repository | svnadmin load /var/svn/new_repo < backup.dump |
svnadmin hotcopy |
Creates an active hot backup without service interruption | svnadmin hotcopy /var/svn/repo /backup/repo_hot |
svnadmin verify |
Validates data block integrity and checksums | svnadmin verify /var/svn/repo |
svnadmin recover |
Repairs inconsistent repository transactions after crashes | svnadmin recover /var/svn/repo |