Subversion Cheat Sheet

Subversion Cheat Sheet

After compiling a GIT Cheat Sheet, I thought to write the same for subversion (SVN).

Some basic commands related to subversion (svn) which can be used on a day-to-day basis.

Subversion Cheat Sheet

Subversion (svn) Help

The subversion (svn) help can be accessed via help

svn help
svn help
svn help import ## This will show the help page for the svn command “import”

Subversion (svn) Component

svn		:Command line program
svnversion	:Revision of working copy
svnlook		:Inspect repository
svnadmin	:Repository administration
svndumpfilter	:Filter repository stream
mod_dav_svn	:Apache module
svnserve	:SVN server (SVN protocol)
svnsync		:Mirror repository

Subversion (svn) Protocols

file://		:Local machine
http://		:HTTP (Apache)
https://	:HTTPS (SSL)
svn://		:SVN (svnserve)
svn+ssh://	:SVN over SSH

Create a Subversion (svn) Repository

On the same server running svn repo-

svnadmin create “/path/to/repository”

Backup a Subversion (svn) Repository Or Dump a Subversion (svn) Repository

Dump contents of repository to file

svnadmin dump “repository” > filename

Restore a Subversion (svn) Repository Or Load a Subversion (svn) Repository

Load contents of file into repository

svnadmin load “repository” < filename

Change log message for Subversion (svn) Repository

Change log message for revision 5 of “path” to contents of message.txt

svnadmin setlog “path” -r 5 message.txt

Add local folder to Subversion (svn) Repository

svn import folder “/path/to/repository”

Checkout a Working Copy for Subversion (svn) Repository

Checkout the working copy for the directory “directory” locally in current folder-

svn checkout “/path/to/repository/directory”

Or

svn co “/path/to/repository/directory”

Checkout the working copy for the directory “directory” locally to another folder-

svn checkout “/path/to/repository/directory” /some/other/folder/

Or

svn co “/path/to/repository/directory” /some/other/folder/

Checkout the working copy for the directory “directory” over http/https-

svn checkout “http(s)://mysvn.server.com/svn/my_repo”
svn co “http(s)://mysvn.server.com/svn/my_repo”

Update a Working Copy for Subversion (svn) Repository

Update the working copy to the latest revision-

svn update .

or

svn up .

svn update “/path/to/repository/directory”

Update the working copy to specific revision-

svn update -r7 “/path/to/repository/directory”

Or

svn up -r7 “/path/to/repository/directory”

Add files & folder to Subversion (svn) Repository

Add all items in folder recursively.

svn add *

If myfolder is a folder then all the files and subfolders under myfolder are added using.

svn add myfolder

Add the files/folders forcefully.

svn add * –force

Delete files & folder to Subversion (svn) Repository

svn delete “/path/to/repository/directory”

Delete with message.

svn delete -m “Removing the directory” “/path/to/repository/directory”

Copy a Subversion (svn) Repository

svn copy “source” “destination”

Move/Rename a Subversion (svn) Repository

svn move “source” “destination”

Revert Local (uncommitted) changes to Subversion (svn) Repository

Revert changes made to file.txt.

svn revert “/path/to/repository/directory/file.txt”

Revert changes made to folder recursively.

svn revert -R “/path/to/repository/directory”

View Logs for Subversion (svn) Repository

View log messages from repository

svn log “/path/to/repository/directory”

View commits with messages for Subversion (svn) Repository

svn blame “/path/to/repository/directory”

View difference between files for Subversion (svn) Repository

View changes made to a single file.

svn diff “/path/to/repository/directory/file.txt”

Compare files between different revisions.

We will compare the difference between revision 3 and revision 5.

svn diff “/path/to/repository/directory/[email protected]” “/path/to/repository/directory/[email protected]

Compare all files between different revisions.

svn diff -r 3:5 “/path/to/repository/directory”

Merge Changes for Subversion (svn) Repository

Apply the difference between revision 3 and 5 for file.txt to /path/to/some_new_file.txt

svn merge -r 3:5 “file.txt” “/path/to/some_new_file.txt”

Apply the difference between two URLs to /path/to/some_new_file.txt

svn merge “url1” “url2” “/path/to/some_new_file.txt”

Commit the changes to a Subversion (svn) Repository

svn commit “/path/to/repository”

Commit changes with message-

svn commit -m “Commit Message” “/path/to/repository”

Commit the changes to folder non-recursively-

svn commit -N “/path/to/repository”

Miscellaneous svn commands

resolve "/path/to/repository"	:Resolve conflict
cleanup "/path/to/repository"	:Recursively remove locks and complete operations
lock "/path/to/repository"	:Lock path
unlock "/path/to/repository"	:Unlock path
cat "/path/to/repository"	:View file contents
status "/path/to/repository"	:Get path status

SVN Repository status

''		: No modifications
'A'		: Addition
'D'		: Deletion
'M'		: Modified
'R'		: Item replaced
'C'		: In conflict
'X'		: Externals definition
'I'		: Ignored
'?'		: Not in repository
'!'		: Item missing
'~'		: Object type changed

Subversion Cheat Sheet

No Comments

Post a Comment

Time limit is exhausted. Please reload CAPTCHA.