Many times we want to get a single file from svn repo but we do not want to checkout the complete repository. With the help of svn checkout
we can also get a single file checkout that creates a working copy, that contains meta-information about the repository, revision, attributes, etc. That metadata is stored in subdirectories named ‘.svn’. And single files don’t have subdirectories
svn export
With the help of svn export
we can get a
single file even without any working copy, that contains meta-information about the repository, revision, attributes, etc.
export can be used for exporting directory also.
Syntax:
svn export [-r REV] URL[@PEGREV] [PATH]
exports
a clean directory tree from the repository specified by URL
—at revision REV
if it is given; otherwise, at HEAD
, into PATH
. If PATH
is omitted, the last component of the URL
is used for the local directory name.
Syntax:
svn export [-r REV] PATH1[@PEGREV] [PATH2]
exports
a clean directory tree from the working copy specified by PATH1
into PATH2
. All local changes will be preserved, but files not under version control will not be copied.
Example:
svn export <file_url_path>
Example:
svn export https://xyz.com/svn/Test/branches/ActiveCode/1.txt
svn export <file_source_url> <path_where_export_go>
Example:
svn export https://xyz.com/svn/Test/branches/ActiveCode/1.txt D:/dump
svn export <path_folder_to_Export>
Example:
svn export https://xyz.com/svn/Test/branches/ActiveCode/
svn export <path_folder_to_Export> <path_where_export_go>
Example:
svn export https://xyz.com/svn/Test/branches/ActiveCode/ D:/dump
FAQ
They are the same except that Export doesn’t include the .svn folders and Checkout does include them. Also note that an export cannot be updated.
When you do a Subversion checkout, every folder and subfolder contains a .svn folder. These.svn folders contain clean copies of all files checked out and .tmp directories that contain temporary files created during checkouts, commits, update and other operations.
An Export will be about half the size of a Checkout due to the absence of the .svn folders that duplicate all content.