SVN Cheatsheet
#
Subversion (SVN) is an open-source version control system that manages files and directories, and the changes made to them, over time. It allows users to recover older versions of their data or examine the history of how their data has changed. Subversion was created by CollabNet Inc. in 2000 and is widely used in software development for maintaining current and historical versions of files such as source code, web pages, and documentation.
Repository Management
#
Command/Option | Example | Description |
---|
svnadmin create | svnadmin create /path/to/repo | Create a new SVN repository |
svn checkout (co) | svn checkout https://example.com/repo | Check out a working copy from a repository |
svn import | svn import /path/to/project https://example.com/repo -m "Initial import" | Import a project into a repository |
Working with Repositories
#
Command/Option | Example | Description |
---|
svn update (up) | svn update | Bring changes from the repository into the working copy |
svn commit (ci) | svn commit -m "Commit message" | Send changes from the working copy to the repository |
svn add | svn add file.txt | Schedule a file or directory for addition to the repository |
svn delete (del) | svn delete file.txt | Schedule a file or directory for deletion from the repository |
svn copy (cp) | svn copy trunk/branch new-branch | Copy a file or directory in the repository |
svn move (mv) | svn move old-name new-name | Move or rename a file or directory in the repository |
Viewing Changes
#
Command/Option | Example | Description |
---|
svn status (stat, st) | svn status | Print the status of working copy files and directories |
svn diff | svn diff | Display the differences between two revisions or paths |
svn log | svn log | Show the log messages for a set of revision(s) and/or path(s) |
Branching and Tagging
#
Command/Option | Example | Description |
---|
svn copy (cp) | svn copy trunk branches/new-branch -m "Creating a new branch" | Create a branch |
svn copy (cp) | svn copy trunk tags/release-1.0 -m "Tagging version 1.0" | Create a tag |
Merging Changes
#
Command/Option | Example | Description |
---|
svn merge | svn merge https://example.com/repo/branches/branch | Merge changes from one branch into another |
svn resolve | svn resolve --accept working file.txt | Resolve conflicts on a working copy |
Repository Maintenance
#
Command/Option | Example | Description |
---|
svnadmin dump | svnadmin dump /path/to/repo > repo_dumpfile | Create a dump of the repository |
svnadmin load | svnadmin load /path/to/repo < repo_dumpfile | Load a dump file into a repository |
svnadmin verify | svnadmin verify /path/to/repo | Verify the integrity of the repository data |
Miscellaneous
#
Command/Option | Example | Description |
---|
svn info | svn info | Display information about a local or remote item |
svn revert | svn revert file.txt | Revert changes in the working copy |
svn cleanup | svn cleanup | Recursively clean up the working copy |
svn propget (pget) | svn propget svn:ignore | Get the value of a property on files, directories, or revisions |
svn propset (pset) | svn propset svn:ignore "*.log" . | Set the value of a property on files, directories, or revisions |
svn proplist (plist) | svn proplist -v | List all properties on files, directories, or revisions |
This cheatsheet covers the most commonly used SVN commands and options, helping you to manage repositories, commits, branches, merges, and more effectively.