svn is the official command-line client of Subversion. Its functionality is offered via a collection of task-specific subcommands, most of which accept a number of options for fine-grained control of the program's behavior.
When using the svn program, subcommands and other non-option arguments must appear in a specified order on the command line. Options, on the other hand, may appear anywhere on the command line (after the program name, of course), and in general, their order is irrelevant. For example, all of the following are valid ways to use svn status, and are interpreted in exactly the same way:
$ svn -vq status myfile $ svn status -v -q myfile $ svn -q status -v myfile $ svn status -vq myfile $ svn status myfile -qv
The following sections describe each of the various subcommands and options provided by the svn command-line client program, including some examples of each subcommand's typical uses.
While Subversion has different options for its
subcommands, all options exist in a single
namespace—that is, each option is guaranteed to mean the
roughly 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.
The svn command-line client usually exits quickly with an error if you pass it an option which does not apply to the specified subcommand. But as of Subversion 1.5, several of the options which apply to all—or nearly all—of the subcommands have been deemed acceptable by all subcommands, even if they have no effect on some of them. (This change was made primarily to improve the client's ability to called from custom wrapping scripts.) These options appear grouped together in the command-line client's usage messages as global options, as can be seen in the following bit of output:
$ svn help upgrade
upgrade: Upgrade the metadata storage format for a working copy.
usage: upgrade [WCPATH...]
Local modifications are preserved.
Valid options:
-q [--quiet] : print nothing, or only summary information
Global options:
--username ARG : specify a username ARG
--password ARG : specify a password ARG
--no-auth-cache : do not cache authentication tokens
--non-interactive : do no interactive prompting (default is to prompt
only if standard input is a terminal device)
--force-interactive : do interactive prompting even if standard input
is not a terminal device
--trust-server-cert : accept SSL server certificates from unknown
certificate authorities without prompting (but only
with '--non-interactive')
--config-dir ARG : read user configuration files from directory ARG
--config-option ARG : set user configuration option in the format:
FILE:SECTION:OPTION=[VALUE]
For example:
servers:global:http-library=serf
$
svn subcommands recognize the following options:
svn Options
-
--acceptACTION -
Specifies an action for automatic conflict resolution, disabling the interactive prompts which ask the user how to handle each conflict as it is noticed. Though which of the specific actions are applicable differs depending on which subcommand is in use, Subversion supports the following long (and short) values for
ACTION:postpone(p)Take no resolution action at all and instead allow the conflicts to be recorded for future resolution.
edit(e)Open each conflicted file in a text editor for manual resolution of line-based conflicts.
launch(l)Launch an interactive merge conflict resolution tool for each conflicted file.
baseChoose the file that was the (unmodified)
BASErevision before you tried to integrate changes from the server into your working copy.workingAssuming that you've manually handled the conflict resolution, choose the version of the file as it currently stands in your working copy.
mine-full(mf)Resolve conflicted files by preserving all local modifications and discarding all changes fetched from the server during the operation which caused the conflict.
theirs-full(tf)Resolve conflicted files by discarding all local modifications and integrating all changes fetched from the server during the operation which caused the conflict.
mine-conflict(mc)Resolve conflicted files by preferring local modifications over the changes fetched from the server in conflicting regions of each file's content.
theirs-conflict(tc)Resolve conflicted files by preferring the changes fetched from the server over local modifications in conflicting regions of each file's content.
Consult the output of svn help
SUBCOMMANDto see exactly which actions are supported by the specific subcommand of interest. -
--allow-mixed-revisions Disables the verification—performed by default by svn merge as of Subversion 1.7—that the target of a merge operation and all of its children are at a uniform revision. While merging into a single-revision working copy target is the recommended best practice, this option may be used to permit merges into mixed-revision working copies as necessary.
-
--auto-props Enables automatic property assignment (per runtime configuration rules), overriding the
enable-auto-propsruntime configuration directive.-
--change(-c)ARG Perform the requested operation using a specific “change”. Generally speaking, this option is syntactic sugar for
-r. Some subcommands permit a comma-separated list of revision number arguments (e.g.,ARG-1:ARG-c). Alternatively, you can provide two arguments separated by a dash (as inARG1,ARG2,ARG3-c) to identify the range of revisions betweenARG1-ARG2ARG1andARG2, inclusive. Finally, if the revision argument is negated, the implied revision range is reversed:-c -45is equivalent to-r 45:44.-
--changelist(--cl)ARG Instructs Subversion to operate only on members of the changelist named
ARG. You can use this option multiple times to specify sets of changelists.-
--config-dirDIR -
Instructs Subversion to read configuration information from the specified directory instead of the default location (
.subversionin the user's home directory).NoteThis option is accepted by all svn subcommands.
-
--config-optionCONFSPEC -
Sets, for the duration of the command, the value of a runtime configuration option.
CONFSPECis a string which specifies the configuration option namespace, name and value that you'd like to assign, formatted asFILE:SECTION:OPTION=[VALUE]. In this syntax,FILEandSECTIONare the runtime configuration file (eitherconfigorservers) and the section thereof, respectively, which contain the option whose value you wish to change.OPTIONis, of course, the option itself, andVALUEthe value (if any) you wish to assign to the option. For example, to temporarily disable the use of the compression in the HTTP protocol, use--config-option=servers:global:http-compression=no. You can use this option multiple times to change multiple option values simultaneously.NoteThis option is accepted by all svn subcommands.
-
--depthARG Instructs Subversion to limit the scope of an operation to a particular tree depth.
ARGis one ofempty(only the target itself),files(the target and any immediate file children thereof),immediates(the target and any immediate children thereof), orinfinity(the target and all of its descendants—full recursion).-
--diff Enables a special output mode for svn log which includes a difference report (a la svn diff) as part of each revision's information.
-
--diff-cmdCMD Specifies an external program to use to show differences between files. When svn diff is invoked without this option, it uses Subversion's internal differencing engine, which provides unified diffs by default. If you want to use an external differencing program, use
--diff-cmd. You can then pass options to the specified program using the--extensions(-x) option.-
--diff3-cmdCMD Specifies an external 3-way differencing program (used to merge line-based changes into files).
-
--dry-run Goes through all the motions of running a command, but makes no actual changes—either on disk or in the repository.
-
--editor-cmdCMD Specifies an external program to use to edit a log message or a property value. See the
editor-cmdsection in the section called “General configuration” for ways to specify a default editor.-
--encodingENC Tells Subversion that your commit message is composed using the character encoding provided. The default character encoding is derived from your operating system's native locale; use this option if your commit message is composed using any other encoding.
-
--extensions(-x)ARG -
Specifies customizations which Subversion should make when performing difference calculations. Valid extensions include:
--ignore-space-change(-b)Ignore changes in the amount of white space.
--ignore-all-space(-w)Ignore all white space.
--ignore-eol-styleIgnore changes in EOL (end-of-line) style.
--show-c-function(-p)Show C function names in the diff output.
--unified(-u)Show three lines of unified diff context.
The default value of
ARGis-u. If you wish to pass multiple arguments, you must enclose all of them in quotes.Note that when Subversion is configured to invoke an external diff command, the value of the
--extensions(-x) option isn't restricted to the previously mentioned options, but may be any additional arguments which Subversion should pass to that command. -
--file(-F)FILENAME Uses the contents of the named file for the specified subcommand. Different subcommands do different things with this content. For example, svn commit uses the content as a commit log message, whereas svn propset uses it as a property value.
-
--force Forces a particular command or operation to run. Subversion will prevent you from performing some operations in normal usage, but you can pass this 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.
-
--force-log Forces a suspicious parameter passed to the
--message(-m) or--file(-F) option to be accepted as valid. By default, Subversion will produce an error if parameters to these options look like they might instead be targets of the subcommand. For example, if you pass a versioned file's path to the--file(-F) option, Subversion will assume you've made a mistake, that the path was instead intended as the target of the operation, and that you simply failed to provide some other—unversioned—file as the source of your log message. To assert your intent and override these types of errors, pass the--force-logoption to subcommands that accept log messages.-
--force-interactive -
Forces the svn command-line client to run in interactive mode when standard input is not a terminal device.
NoteThis option is accepted by all svn subcommands.
-
--git Enables a special output mode for svn diff designed for cross-compatibility with the popular Git distributed version control system.
-
--help(-h,-?) 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.
-
--ignore-ancestry Tells Subversion to ignore ancestry when calculating differences (rely on path contents alone). Also disables Merge Tracking when used with the svn merge subcommand.
-
--ignore-externals Tells Subversion to ignore externals definitions and the external working copies managed by them.
-
--ignore-keywords Disables keyword expansion.
-
--ignore-properties Instructs svn diff to suppress output of property changes.
-
--ignore-whitespace Instructs svn patch to ignore whitespace when attempting to identify patch context.
-
--incremental Prints output in a format suitable for concatenation to prior similar output.
-
--internal-diff Instructs Subversion to use its built-in differencing engine despite any external differencing mechanism that may be specified for use in the user's runtime configuration.
-
--keep-changelists Tells Subversion not to remove the changelist assigments from working copy items after committing.
-
--keep-local Keeps the local copy of a file or directory (used with the svn delete command).
-
--limit(-l)NUM Shows only the first
NUMlog messages.-
--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."
-
--native-eolARG Causes svn export to use a specific end-of-line sequence as if it was the native sequence for the client platform.
ARGmay be one ofCR,LF, orCRLF.-
--newARG Uses
ARGas the newer target (for use with svn diff).-
--no-auth-cache -
Prevents caching of authentication information (e.g., username and password) in the Subversion runtime configuration directories.
NoteThis option is accepted by all svn subcommands.
-
--no-auto-props Disables automatic property setting, overriding the
enable-auto-propsruntime configuration directive.-
--no-diff-added Prevents Subversion from printing differences for added files. The default behavior when you add a file is to print the same differences that you would see if you had added the entire contents of an existing (empty) file.
-
--no-diff-deleted Prevents Subversion from printing differences for deleted files. The default behavior when you remove a file is for svn diff to print the same differences that you would see if you had kept the file but removed all of its content.
-
--no-ignore Shows files in the status listing or adds/imports files that would normally be omitted since they match a pattern in the
global-ignoresconfiguration option or thesvn:ignoreorsvn:global-ignoresproperties. See the section called “General configuration” and the section called “Ignoring Unversioned Items” for more information.-
--no-unlock Tells Subversion not to automatically unlock files. (The default commit behavior is to unlock all files listed as part of the commit.) See the section called “Locking” for more information.
-
--non-interactive -
Disables all interactive prompting. Some examples of interactive prompting include requests for authentication credentials and conflict resolution decisions. This is useful if you're running Subversion inside an automated script and it's more appropriate to have Subversion fail than to prompt for more information.
Beginning with Subversion 1.8, the svn command-line client, by default, is non-interactive when standard input is not a terminal device. Pass the
--force-interactiveoption to make the client run in interactive mode.NoteThis option is accepted by all svn subcommands.
-
--non-recursive(-N) Deprecated. Stops a subcommand from recursing into subdirectories. Most subcommands recurse by default, but some do not. Users should avoid this option and use the more precise
--depthoption instead. For most subcommands, specifying--non-recursiveproduces behavior which is the same as if you'd specified--depth=files, but there are exceptions: non-recursive svn status operates at theimmediatesdepth, and the non-recursive forms of svn revert, svn add, and svn commit operate at anemptydepth.-
--notice-ancestry Pays attention to ancestry when calculating differences.
-
--oldARG Uses
ARGas the older target (for use with svn diff).-
--parents Creates and adds nonexistent or nonversioned parent directories 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.
-
--passwordPASSWD -
Specifies the password to use when authenticating against a Subversion server. If not provided, or if incorrect, Subversion will prompt you for this information as needed.
NoteThis option is accepted by all svn subcommands.
-
--patch-compatible Instructs svn diff to produce output compatible with generic third-party patch tools. The result of using this option is the same as running svn diff with
--show-copies-as-adds --ignore-propertiesoptions.-
--properties-only Instructs svn diff to show only property changes.
-
--quiet(-q) Requests that the client print only essential information while performing an operation.
-
--record-only Enables a special mode of svn merge in which the specified merge operation is recorded in the local merge tracking information, but is not actually performed.
-
--recursive(-R) Makes a subcommand recurse into subdirectories. (Most subcommands recurse by default.)
-
--reintegrate Deprecated. Used with the svn merge subcommand to merge changes from a feature branch back into the feature branch's ancestor branch. Since Subversion 1.8 the svn merge subcommand automatically detects this scenario and performs the appropriate merge. See the section called “Reintegrating a Branch” for details.
-
--relocate Deprecated. When used with the svn switch subcommand, changes the location of the repository that your working copy references. The preferred approach as of Subversion 1.7, however, is to use the svn relocate subcommand. See svn relocate for more details and an example.
-
--remove Used with svn changelist to disassociate—rather than associate (which is the default operation)—the target(s) from a changelist.
-
--reverse-diff Causes svn patch to interpret the input patch instructions in reverse—treating added lines as removed ones and vice-versa.
-
--revision(-r)REV -
Specifies a revision (or range of revisions) on with which to operate. 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}See the section called “Revision Keywords” for more information.
-
--revprop Operates on a revision property instead of a property specific to a file or directory. This option requires that you also pass a revision with the
--revision(-r) option.-
--searchARG -
Filters log messages to show only those that match the search pattern
ARG. Log messages are displayed only if the provided search pattern matches any of the author, date, log message text (unless--quietis used), or, if the--verboseoption is also provided, a changed path. If multiple--searchoptions are provided, a log message is shown if it matches any of the provided search patterns. If--limitis used, it restricts the number of log messages searched, rather than restricting the output to a particular number of matching log messages.The search pattern (also called glob or shell wildcard pattern) can contain regular characters and the following wildcard characters:
-
? Matches any single character.
-
* Matches a sequence of arbitrary characters.
-
[ABC] Matches any of the characters listed inside the brackets.
-
-
--search-andARG The option's argument is combined with the pattern from the previous
--searchor--search-andoption on the command line. Log message is shown only if it matches the combined search pattern.-
--set-depthARG Sets the sticky depth on a directory in a working copy to one of
exclude,empty,files,immediates, orinfinity. For detailed coverage of what these mean and how to use this option, see the section called “Sparse Directories”.-
--show-copies-as-adds Enables a special output mode for svn diff in which the content difference for a file created via a copy operation appears as it would for a brand new file (with each line therein appearing as an addition to an empty file) rather than as a delta against the original file from which the copy was created.
-
--show-inherited-props Causes svn propget and svn proplist to display the versioned properties inherited by the target file or directory.
-
--show-revsARG Used to make svn mergeinfo display certain classes of merge tracking information.
ARGmay be eithermergedoreligible, indicating a desire to see revisions either already merged or eligible for future merge from the specified source URL, respectively.-
--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 then use svn update.
-
--stop-on-copy 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.
-
--strict Causes Subversion to use strict semantics, a notion that is rather vague unless talking about specific subcommands (namely, svn propget).
-
--stripNUM Used by svn patch to ignore
NUMleading path components found on paths specified in the patch input file.-
--summarize Display only high-level summary notifications about the operation instead of its detailed output.
-
--targetsFILENAME Tells Subversion to read additional target paths for the operation from
FILENAME.FILENAMEshould contain one path per line, with each path expected to use the same encoding and formatting that it would if you had specified it directly as an argument on the command line.-
--trust-server-cert -
When used with
--non-interactive, instructs Subversion to accept SSL server certificates issued by unknown certificate authorities without first prompting the user. For security's sake, you should use this option only when the integrity of the remote server and the network path between it and your client is known to be trustworthy.NoteThis option is accepted by all svn subcommands.
-
--use-merge-history(-g) Uses or displays additional information from merge history.
-
--usernameNAME -
Specifies the username to use when authenticating against a Subversion server. If not provided, or if incorrect, Subversion will prompt you for this information as needed.
NoteThis option is accepted by all svn subcommands.
-
--verbose(-v) Requests that the client print out as much information as it can while running any subcommand. This may result in Subversion printing out additional fields, detailed information about every file, or additional information regarding its actions.
-
--version Prints the client version info. This information includes not only the version number of the client, but also a listing of all repository access modules that the client can use to access a Subversion repository. With
--quiet(-q) it prints only the version number in a compact form.-
--with-all-revprops Used with the
--xmloption to svn log, instructs Subversion to retrieve and display all revision properties—the standard ones used internally by Subversion as well as any user-defined ones—in the log output.-
--with-no-revprops Used with the
--xmloption to svn log, instructs Subversion to omit all revision properties—including the standard log message, author, and revision datestamp—from the log output.-
--with-revpropARG When used with any command that writes to the repository, sets the revision property, using the
NAME=VALUEformat,NAMEtoVALUE. When used with svn log in--xmlmode, this displays the value ofARGin the log output.-
--xml Prints output in XML format. XML schemas for the output (in RELAX NG format) are maintained in the
subversion/svn/schema/directory of the Subversion source tree.
Table of Contents
- svn add
- svn blame (praise, annotate, ann)
- svn cat
- svn changelist (cl)
- svn checkout (co)
- svn cleanup
- svn commit (ci)
- svn copy (cp)
- svn delete (del, remove, rm)
- svn diff (di)
- svn export
- svn help (h, ?)
- svn import
- svn info
- svn list (ls)
- svn lock
- svn log
- svn merge
- svn mergeinfo
- svn mkdir
- svn move (mv)
- svn patch
- svn propdel (pdel, pd)
- svn propedit (pedit, pe)
- svn propget (pget, pg)
- svn proplist (plist, pl)
- svn propset (pset, ps)
- svn relocate
- svn resolve
- svn resolved
- svn revert
- svn status (stat, st)
- svn switch (sw)
- svn unlock
- svn update (up)
- svn upgrade