Subversion 完全参考


The Subversion Command-Line Client: svn
Subversion Properties

This chapter is intended to be a complete reference to using Subversion. This includes the command-line client (svn) and all its subcommands, as well as the repository administration programs (svnadmin and svnlook) and their respective subcommands.

The Subversion Command-Line Client: svn

To use the command-line client, type svn, the subcommand you wish to use, and [54] any options or targets that you wish to operate on—there is no specific order that the subcommand and the options must appear in. For example, all of the following are valid ways to use svn status:

$ svn -v status
$ svn status -v 
$ svn status -v myfile

你可以在第 2 章 基本使用发现更多使用客户端命令的例子,以及“属性”一节中的管理属性的命令。


While Subversion has different options for its subcommands, all options are global—that is, each option is guaranteed to mean the same thing regardless of the subcommand you use it with. For example, --verbose (-v) always means “verbose output,” regardless of the subcommand you use it with.

--accept ACTION

Specify action for automatic conflict resolution. Possible actions are (postpone, base, mine-full, theirs-full, edit, and launch.



--change (-c) ARG

作为引用特定“修改”(也叫做修订版本)的方法,这个选项是“-r ARG-1:ARG”语法上的甜头。

--changelist ARG

Operate only on members of the changelist named ARG. This option can be used multiple times to specify sets of changelists.

--cl ARG

This is an alias for the --changelist option.

--config-dir DIR


--depth ARG

Limit the scope of an operation to a particular tree depth. ARG is one of empty, files, immediates, or infinity.

--diff-cmd CMD

指定用来表示文件区别的外部程序,当svn diff调用时,会使用Subversion的内置区别引擎,默认会提供统一区别输出,如果你希望使用一个外置区别程序,使用--diff-cmd。你可以通过--extensions(本小节后面有更多介绍)把选项传递到区别程序。

--diff3-cmd CMD




--editor-cmd CMD


--encoding ENC


--extensions (-x) ARGS

指定一个或多个Subversion传递给提供文件区别的外部区别程序的参数,如果你要传递多个参数,你一定能够要用引号(例如,svn diff --diff-cmd /usr/bin/diff -x "-b -E")括起所有的参数。这个选项只有在使用--diff-cmd选项时使用。

--file (-F) FILENAME

为特定子命令使用命名文件的的内容,尽管不同的子命令对这些内容做不同的事情。例如,svn commit使用内容作为提交日志,而svn propset使用它作为属性值。


Forces a particular command or operation to run. There are some operations that Subversion will prevent you from doing in normal usage, but you can pass the force option to tell Subversion “I know what I'm doing as well as the possible repercussions of doing it, so let me at 'em.” This option is the programmatic equivalent of doing your own electrical work with the power on—if you don't know what you're doing, you're likely to get a nasty shock.



--help (-h) or -?)

If used with one or more subcommands, shows the built-in help text for each. If used alone, it displays the general client help text.








Don't delete the changelist after commit.


Keep the local copy of a file or directory (used with the svn delete command).

--limit NUM


--message (-m) MESSAGE

Indicates that you will specify either a log message or a lock comment on the command line, following this option. For example:

$ svn commit -m "They don't make Sunday."
--new ARG

使用ARG作为新的目标(结合svn diff使用)。


Prevents caching of authentication information (e.g., username and password) in the Subversion administrative directories.




防止Subversion打印删除文件的区别信息,缺省的行为方式是当你删除了一个文件后运行svn diff打印的区别与删除文件所有的内容得到的结果一样。






In the case of an authentication failure or insufficient credentials, prevents prompting for credentials (e.g., username or password). This is useful if you're running Subversion inside of an automated script, and it's more appropriate to have Subversion fail than to prompt for more information.

--non-recursive (-N)

Deprecated. Stops a subcommand from recursing into subdirectories. Most subcommands recurse by default, but some subcommands—usually those that have the potential to remove or undo your local modifications—do not.



--old ARG

使用ARG作为旧的目标(结合svn diff使用)。


Create and add nonexistent or nonversioned parent subdirectories to the working copy or repository as part of an operation. This is useful for automatically creating multiple subdirectories where none currently exist. If performed on a URL, all the directories will be created in a single commit.

--password PASS


--quiet (-q)



Mark revisions as merged (for use with --revision (-r)

--recursive (-R)

Deprecated. Makes a subcommand recurse into subdirectories. Most subcommands recurse by default.

--reintegrate (-R)

Used with the svn merge subcommand, merges all of the source URL's changes into the working copy. See “Keeping a Branch in Sync”一节 for details.

--relocate 目的路径[PATH...]

svn switch子命令中使用,用来修改你的工作拷贝所引用的版本库位置。当版本库的位置修改了,而你有一个工作拷贝,希望继续使用时非常有用。见svn switch的例子。

--remove ARG

Disassociate ARG from a changelist

--revision (-r) REV

Indicates that you're going to supply a revision (or range of revisions) for a particular operation. You can provide revision numbers, keywords, or dates (in curly braces) as arguments to the revision option. If you wish to offer a range of revisions, you can provide two revisions separated by a colon. For example:

$ svn log -r 1729
$ svn log -r 1729:HEAD
$ svn log -r 1729:1744
$ svn log -r {2001-12-04}:{2002-02-17}
$ svn log -r 1729:{2002-02-17}




--set-depth ARG

Set the sticky depth on a directory in a working copy to one of empty, files, immediates, or infinity.

--show-updates (-u)

Causes the client to display information about which files in your working copy are out of date. This doesn't actually update any of your files—it just shows you which files will be updated if you run svn update.


Causes a Subversion subcommand that traverses the history of a versioned resource to stop harvesting that historical information when a copy—that is, a location in history where that resource was copied from another location in the repository—is encountered.


Causes Subversion to use strict semantics, a notion that is rather vague unless talking about specific subcommands (namely, svn propget).

--targets FILENAME

Tells Subversion to get the list of files that you wish to operate on from the filename that you provide instead of listing all the files on the command line.

--username NAME


--use-merge-history (-g)

Use or display additional information from merge history.

--verbose (-v)





Used with svn log --xml, this option will retrieve and display all revision properties in the log output.

--with-revprop ARG

When used with any command that writes to the repository, this sets the revision property, using the NAME=VALUE format, NAME to VALUE. When used with svn log --xml, this displays the value of ARG in the log output.




Here are the various subcommands.

[54] Well, you don't need a subcommand to use the --version option, but we'll get to that in just a minute.