• SVN Import Defined




    The import command is the easiest way to migrate snapshots into a Subversion repository. This document clarifies the particular syntax and usage of this command.


    Whether the goal is to bring in particular snapshots from other version control tools or to add a local directory structure to your existing Subversion repository, the 'svn import' command is a useful and easy to execute tool.

    Command Name

    svn import - Add and commit an unversioned file or directory structure to an existing Subversion repository.

    General Syntax

    svn import [PATH] URL

    Command Description

    Recursively add and commit a copy of PATH to URL. If PATH is not present, then the current directory is assumed. Parent directories are created in the repository as necessary.

    Scope of Changes

    Directly modifies the repository itself, but not a working copy. Working copies must use the 'svn update' command to reflect the changes made to the repository by this command in the local working copy(ies).

    Online or Offline Operation

    This command requires online access to the repository server and cannot be executed in offline mode.

    Applicable Switches

    --message (-m) TEXT Indicates the commit log message you want associated with this command's execution
    --file (-F) FILE The file listed should be used for the arguments in the execution of this command
    --quiet (-q) Only essential information should be output during the execution of this command
    --non-recursive (-N) Do not recurse beyond the directory that is the target of this command (default is recursive)
    --username USER User's login account
    --password PASS User's login password
    --no-auth-cache Tells Subversion not to cache the username and password in its administrative directories
    --non-interactive Do not prompt for username and/or password
    --force-log Tells Subversion to accept a suspicious parameter passed to the message or file switches as valid rather than to produce an error
    --editor-cmd EDITOR Tells Subversion to use an external editor to enter the commit log message
    --encoding ENC Tells Subversion that your commit log message is encoded in the characterset indicated
    --config-dir DIR Informs Subversion to read configuration from the specified directory rather than the default location
    --auto-props Enables auto-props (overriding what is set in config file)
    --no-auto-props Disables auto-props (overriding what is set in config file)
    --ignore-externals Tells Subversion to ignore any defined externals when executing this command


    Import the local myproj directory into the root of the repository:
    $ svn import -m "New import" myproj http://svn.open.collab.net/repos/projects/trunk
    Adding myproj/sample.txt
    Transmitting file data ............
    Committed revision 16.
    Import the local myproj directory into the trunk/misc directory (which does not need to exist in the repository prior to executing this command as the command will create the directory).
    $ svn import -m "New import" myproj http://svn.open.collab.net/repos/projects/trunk/misc
    Adding myproj/sample.txt
    Transmitting file data ............
    Committed revision 19.

    Keep in mind that while these examples added directories and files to the repository, they did not create or update a working copy to reflect those changes. You need to either update an existing working copy or do a checkout to create a new one.