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

SVN Cheat Sheet Table: Essential Commands and Concepts

CategoryCommandDescription / Notes
Check SVN Versionsvn --versionDisplays the installed SVN version.
Check Out Repositorysvn checkout <repo_url> <dir>Clones a remote repository into a local directory.
Update Repositorysvn updateFetches the latest changes from the repository.
Add Filessvn add <file>Schedules a file for addition to the repository.
Commit Changessvn commit -m "Commit message"Pushes local changes to the repository.
Status of Filessvn statusShows modified, untracked, and added files.
Diff Changessvn diffDisplays differences between working copy and repository.
View Log Historysvn logShows commit history of the repository.
Revert Changessvn revert <file>Discards local modifications in a file.
Remove a Filesvn delete <file>Removes a file from the repository.
Move a Filesvn move <source> <destination>Moves a file within the repository.
Rename a Filesvn rename <old_name> <new_name>Renames a file while keeping version history.
List Filessvn listLists all files in the repository.
Branch Creationsvn copy <repo_url>/trunk <repo_url>/branches/branch_name -m "Creating a branch"Creates a new branch.
Switch Branchsvn switch <repo_url>/branches/branch_nameSwitches working copy to a different branch.
Merge Branchsvn merge <source_branch>Merges a branch into the working copy.
View Merged Infosvn mergeinfo --show-revs merged <branch>Checks merged revisions from a branch.
Create a Tagsvn copy <repo_url>/trunk <repo_url>/tags/tag_name -m "Creating a tag"Creates a new tag.
Delete a Tagsvn delete <repo_url>/tags/tag_name -m "Deleting tag"Deletes a tag.
Resolve Conflictssvn resolve --accept=theirs-full <file>Resolves conflicts by accepting repository changes.
Show Blame Infosvn blame <file>Shows line-by-line revision history of a file.
Show Repository Infosvn infoDisplays details of the current repository.
Export Repositorysvn export <repo_url> <target_dir>Exports files without SVN metadata.
Lock a Filesvn lock <file>Locks a file to prevent modifications by others.
Unlock a Filesvn unlock <file>Unlocks a previously locked file.
Cleanupsvn cleanupFixes interrupted operations and clears temporary files.
Set Propertiessvn propset <property> <value> <file>Sets custom properties on files or directories.
Show Propertiessvn proplist <file>Lists properties assigned to a file.
View Property Valuesvn propget <property> <file>Displays the value of a specific property.
Ignore Filessvn propset svn:ignore "*.log" .Ignores specific files (e.g., log files).
Check Repository URLsvn info --show-item urlDisplays the repository URL of the current working copy.
Check Last Changed Revisionsvn info --show-item last-changed-revisionShows the last committed revision.
Check If Working Copy Is Modifiedsvn status -qShows 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:

svn 2

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

4.8 4 votes
Would You Like to Rate US

You May Also Like

More From Author

4.8 4 votes
Would You Like to Rate US
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments