Below is a quick reference for several of the most commonly used Subversion commands. Since I have been using both Git and Subversion lately for different projects, I routinely get the commands for the two confused. To help out with that, I created this quick reference.

Commands

checkout / co

Checks out a working copy of the course code into the given directory
svn checkout REPO_URL FOLDER
svn co REPO_URL FOLDER

import

Imports the directory and all files/sub-directories into the subversion server at the specified URL. The URL can be several levels deep.
svn import -m "Import Message" FOLDER REPO_URL

update

Updates the repository to the most recent code.
svn update
Add the -r option to update to a specific revision number.
svn update -r REV

revert

Reverts all the changes made to the current working copy that have not yet been committed. Adding the optional FILE will result in only that file being reverted. The -R flag will tell the command to recurse into all sub-directories as well.
svn revert [-R] [FILE]

diff

Shows the differences between the local copy of FILE and the current working copy.
svn diff FILE

info

Gives you info about the current working copy, including the URL of the repository it points to, and the last changed date/author.
svn info

list

This will list the files in source control for the current workspace directory. If you add the optional REPO_URL then it will list all the files in that repo.
svn -v list [REPO_URL]

commit/ci

Sends all changes from your local working copy to the repo. If you do not provde a log message with your commit, svn will launch your editor for you to provide one.
svn commit -m "MESSAGE GOES HERE"

log

Shows log messages from the repo. If no arguments are supplied, svn log shows the log messages for all files and directories inside (and including) the current working directory of your working copy. You can refine the results by specifying a path, one or more revisions, or any combination of the two.
svn log [PATH]

add

Adds the specified file(s) to version control for the repo associated with the current directory. By default it will recurse into any directories you add and add all of the directories content as well. You can set the level of recurrsion using the --depth option.
svn add [PATH(s)] [OPTIONS]

move/mv

This command moves files or directories in your working copy or in the repository. When moving multiple sources, they will be added as children of DST, which must be a directory.
svn move [PATH(s)] [DEST]

delete/del/remove/rm

Removes the specified file(s) from your local machine as well as version control for the repo associated with the current directory. If you want to keep your local files, you can use the option --keep-local. By default this comment will not delete unmodified or unversioned files, unless the --force option is used.
svn delete [PATH(s)] [OPTIONS]

blame/praise/annotate/ann

Shows author and revision information inline for the specified files or URLs. Each line of text is annotated at the beginning with the author (username) and the revision number for the last change to that line.
svn blame [TARGET]

copy/cp

Copies one or more files in your working copy.
svn copy [SRC...] [DST]

References



Published

23 August 2012

Tags