Apache Subversion (SVN) is a widely used version control system that allows developers to track changes, collaborate efficiently, and manage source code repositories. This page provides essential SVN commands and concepts for working with repositories, branches, and version history.
On This Page
Table of Contents
SVN Cheat Sheet Table: Essential Commands and Concepts
Category | Command | Description / Notes |
---|---|---|
Check SVN Version | svn --version | Displays the installed SVN version. |
Check Out Repository | svn checkout <repo_url> <dir> | Clones a remote repository into a local directory. |
Update Repository | svn update | Fetches the latest changes from the repository. |
Add Files | svn add <file> | Schedules a file for addition to the repository. |
Commit Changes | svn commit -m "Commit message" | Pushes local changes to the repository. |
Status of Files | svn status | Shows modified, untracked, and added files. |
Diff Changes | svn diff | Displays differences between working copy and repository. |
View Log History | svn log | Shows commit history of the repository. |
Revert Changes | svn revert <file> | Discards local modifications in a file. |
Remove a File | svn delete <file> | Removes a file from the repository. |
Move a File | svn move <source> <destination> | Moves a file within the repository. |
Rename a File | svn rename <old_name> <new_name> | Renames a file while keeping version history. |
List Files | svn list | Lists all files in the repository. |
Branch Creation | svn copy <repo_url>/trunk <repo_url>/branches/branch_name -m "Creating a branch" | Creates a new branch. |
Switch Branch | svn switch <repo_url>/branches/branch_name | Switches working copy to a different branch. |
Merge Branch | svn merge <source_branch> | Merges a branch into the working copy. |
View Merged Info | svn mergeinfo --show-revs merged <branch> | Checks merged revisions from a branch. |
Create a Tag | svn copy <repo_url>/trunk <repo_url>/tags/tag_name -m "Creating a tag" | Creates a new tag. |
Delete a Tag | svn delete <repo_url>/tags/tag_name -m "Deleting tag" | Deletes a tag. |
Resolve Conflicts | svn resolve --accept=theirs-full <file> | Resolves conflicts by accepting repository changes. |
Show Blame Info | svn blame <file> | Shows line-by-line revision history of a file. |
Show Repository Info | svn info | Displays details of the current repository. |
Export Repository | svn export <repo_url> <target_dir> | Exports files without SVN metadata. |
Lock a File | svn lock <file> | Locks a file to prevent modifications by others. |
Unlock a File | svn unlock <file> | Unlocks a previously locked file. |
Cleanup | svn cleanup | Fixes interrupted operations and clears temporary files. |
Set Properties | svn propset <property> <value> <file> | Sets custom properties on files or directories. |
Show Properties | svn proplist <file> | Lists properties assigned to a file. |
View Property Value | svn propget <property> <file> | Displays the value of a specific property. |
Ignore Files | svn propset svn:ignore "*.log" . | Ignores specific files (e.g., log files). |
Check Repository URL | svn info --show-item url | Displays the repository URL of the current working copy. |
Check Last Changed Revision | svn info --show-item last-changed-revision | Shows the last committed revision. |
Check If Working Copy Is Modified | svn status -q | Shows only modified files (ignoring untracked ones). |
WrapUP
Subversion (SVN) remains a solid choice for version control in many organizations, offering a centralized approach to source code management. This cheat sheet serves as a quick reference for essential SVN operations, helping developers manage repositories, collaborate efficiently, and track changes effectively. Whether you’re working with branches, tags, or conflict resolution, these commands will streamline your workflow.
Bookmark this cheat sheet for quick reference and boost your SVN productivity! 🚀
Check Out Our Other Cheatsheet table:

FAQs
What is SVN, and how does it work?
SVN (Subversion) is a centralized version control system that allows multiple developers to collaborate on a project by tracking changes, managing versions, and storing files in a repository. Users check out a working copy, make changes, and commit updates back to the repository.
How do I install SVN on my system?
SVN can be installed using the following methods:
Windows: Download and install TortoiseSVN.
Linux/macOS: Use the package manager:
— Ubuntu/Debian: sudo apt install subversion
— MacOS: brew install svn
How do I create an SVN repository?
You can create a new SVN repository using the command:svnadmin create /path/to/repo
Then, access it using:svn checkout file:///path/to/repo my_project
How do I check the current SVN version?
Use:svn --version
How do I add new files to the SVN repository?
First, add the file to version control:svn add filename
Then commit the changes:svn commit -m "Added new file"
How do I ignore certain files in SVN?
To ignore files (e.g., .log
files), use:svn propset svn:ignore "*.log" .
svn commit -m "Ignoring log files"
How do I update my working copy with the latest changes?
Use:svn update
How do I check the history of a file?
Use:svn log filename
How do I revert changes in SVN?
To discard local changes in a file:svn revert filename
To revert an entire directory:svn revert -R .
Can I use SVN with an IDE like Eclipse or Visual Studio?
Yes, you can integrate SVN with IDEs using plugins like:
Eclipse: Subclipse
Visual Studio: AnkhSVN or VisualSVN