Scenario: You have a folder of code on a site that is in use but is not connected to SVN. The folder was created by regular FTP process. The Code that is in the folder exists in SVN but was not checked out to the folder, so it is not a working copy.
Desire: you want to get the existing folder connected to SVN so that you can just pull updates from SVN and not maintain a manual synchronization of the files.
I have done this a few times and here is how I connected the existing folder to an existing SVN repository.
How:
Assuming that the SVN repository has the version of the code that you want and you do not want to delete the entire existing folder structure and just do a checkout. (maybe you have image upload folder, or lo files that you do not want to delete)
Checkout the SVN repository branch to the existing folder with the –force option.
cd {existing folder} svn co --force {path to the repository branch to checkout}.
Don’t forget the “.” at the end of the checkout command.
This basically creates a working copy of the SVN repository in the existing folder, but it does not modify any files that already existed in the folder.
After the checkout, SVN update. not sure this is needed at this point, but I run it anyhow. This is also the command I use to update the folder from SVN. the parameters ensure that the SVN copy overwrites any changes. The files should not have been changed outside of SVN anyhow.
svn update --force --accept theirs-full
The files in the existing folder are still not completely in sync with the SVN repository, To get all the files completely in sync with the SVN repository, one more command.
svn revert -R ./
This will result in all the files in the folder being in sync with the repository.
Hope someone find this useful and it saves them time, I know I spent time searching for the answer and as usual, I needed a few pieces from different places to make it happen so I just put them together here.