The svn import command is a quick way to copy an unversioned tree of files into a repository, creating intermediate directories as necessary. svn import doesn't require a working copy, and your files are immediately committed to the repository.
"Import" is to bring something completely outside of version control into SVN. Once something is under SVN control, you can "commit" (new modifications), or "checkout" (stuff you've already committed). At any time, you can "export" some or all of your project into a "clean directory".
Check out files from Subversion repositoryIn the Get from Version Control dialog, click Add Repository Location and specify the repository URL. Click Check Out. In the dialog that opens, specify the destination directory where the local copy of the repository files will be created, and click OK.
Let's say you've used svnadmin to create a repository at /svn/foo/mydirname, and you want to version control /home/user/mydirname (is that what you mean?).
Then do the following:
cd /home/user/mydirname
svn co file:///svn/foo/mydirname . #This only creates the ".svn" folder for version control
svn add ./* #Tell svn you want to version control all files in this dir
svn ci #Check the files in
Your directory is now version controlled!
Yes, you can import an existing directory (with contents) into an SVN repository and use the current location as your version-controlled working copy. Go at it as follows:
Suppose your (un-versioned) project sources are in /home/user/projectx, and your repository is ready at file:///svnrepo
First, create an empty directory somewhere outside of your project tree, say, /tmp/empty
. Import that empty directory in your Subversion repository:
cd /tmp/empty
svn import . file:///svnrepo/projectx
Go into your populated project directory. Now check out the repository location you created in step 1:
cd /home/user/projectx
svn checkout file:///svnrepo/projectx .
This will add the .svn files to your populated project directory, but it will not do anything else, so your existing files are safe.
Next, add the directory with your files to the repository:
svn add *
svn commit -m 'initial commit'
Done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With