简体   繁体   中英

Commit brand new directory with Subversion/Tortoise SVN

I'm working on a project myself. I have subversion setup and using tortoisesvn to manage it. Problem is I have started from scratch and have a separate fully working instance of my project but it's not in subversion.

How do I get that instance into subversion and have as the most recent revision. I tried pasting in files from my non-svn directory over my current svn working copy but not everything appears to have been updated.

I have backups of everything, but it's the code that is in the non-svn folder that I want, I don't want anything from the current working copy?

Does this make sense?

The easiest way to replace the contents of an SVN repository with something completely different is to:

  1. Do a full checkout of the repository,
  2. Delete all the files (Not by using the Windows 'Delete' command, but by using the 'Delete' menu item in the SVN right click sub-menu)
  3. Commit the change,
  4. Copy over the new files and folders you're replacing the old repository contents with,
  5. '+ Add' it all (again, using the SVN right click menu)
  6. Commit the change again.

The downside of this 'easy' method is that you will not be able to use Diff to compare code between these two revisions.

The hard method is to retrace the steps of what files were moved, renamed, deleted, and updated so that you can still use diff between these two revisions. The trick is:

  1. To do everything using SVN right click sub-menu commands, not windows file system operations, so that the changes can be recorded.
  2. To only do one action per file at a time (so if a file was moved to a folder, renamed, and then modified, you should do a commit between each type of change)

I would use WinMerge and compare the two directories, recursively (ignoring .svn folders). Suppose the left side is the SVN working copy, and the right side is the correct project, not under SVN :

  • all files existing at the left side but not at the right side must be deleted
  • all files existing at the right side but not at the left side must be copied to the left and added to SVN
  • all files existing at both sides but not the same must be replaced at the left side by the file at the right side
  • all files existing at both sides and identical must stay as is.

Once you have done all these operations, you just have to commit. This way, you'll keep history, except for renamed/moved files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM