现有目录的SVN设置 [英] SVN Setup Of Existing Directory

查看:315
本文介绍了现有目录的SVN设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在浏览文档等内容,并且可以使用SVN,但我想将其放在现有目录中.我导入了该目录,那么我应该重命名/删除非SVN目录,然后将SVN检出到非SVN目录位置吗?我只是想了解如何使它开始发布到我们的网站URL.

I have been going through documentation and such and have SVN working, but I want to put it on an existing directory. I imported that directory, so do I rename/delete the non SVN directory and then checkout the SVN to the non SVN directory location? I am just trying to understand how to get it to start posting to our website URL.

如果是这样,有什么办法可以保留当前的非SVN并将其设置为SVN,而不是导入和覆盖?

If so, is there any way to keep the current non SVN and make it SVN rather than import and overwrite?

谢谢,我试图了解SVN,但在Web上发现很多教程等内容令人困惑.

Thanks, I am trying to understand SVN, but find a lot of the tutorials and such on the web to be confusing.

推荐答案

是的,您确实拥有它.将代码添加到存储库后,您可以删除或重命名原始代码目录.然后从存储库中将项目检出到与先前代码相同的位置,然后从那里继续工作.

Yes, you have it exactly. Once your code has been added to the repository, you can get rid of or rename your original code directory. Then checkout the project from the repository into the same location as your previous code and continue working from there.

更新

要使其从存储库中更新网站,您实际上需要两个工作目录和一个存储库.

To make it so that your website is updated from the repository, you actually need two working directories, and a repository.

存储库::存储库存储代码和变更集,但不能作为文件系统直接访问.保持备份!

Repository: The repository stores the code and changesets, but isn't directly accessible as a file system. Keep a backup!.

工作目录1:您可以从存储库中检出的工作目录中开发和测试代码.将更改提交回存储库.

Working directory 1: You develop and test your code from a working directory checked out from the repository. Commit changes back to the repository.

工作目录2:重命名Web服务器上的代码目录.将代码副本检出到您的Web服务器中.从技术上讲,它现在是一个工作目录,因为它包含.svn元数据目录,尽管您通常不会在此处进行更改.

Working directory 2: Rename the code directory on your webserver. Checkout a copy of the code to your web server in its place. Technically it is now a working directory, since it contains the .svn metadata directories, though you won't usually make changes here.

在开发工作目录(1)中对代码进行更改,然后将其提交回存储库.如果您对它们能够正常工作并且已经过正确的测试感到满意,请在Web服务器的代码副本(2)上执行svn update(或者,如果您在Web服务器上使用Tortoise SVN,请进行更新).这样会将服务器代码与当前开发版本同步.

Make changes to your code from your development working directory (1) and commit them back to the repository. When you are satisfied that they are working correctly and have been properly tested, on the web server's code copy (2) do svn update (or if you're using Tortoise SVN on the web server, do an update). This will synchronize the server code with the current development version.

Subversion不会自动将更新推送到您的Web服务器.您将需要在需要时进行更新.可以使用所谓的提交后挂钩"使Subversion在进行提交时执行脚本,并且该脚本可以将代码更新或导出到生产Web服务器.但是,您将需要编写脚本,并且它是Subversion的高级用法.我建议尝试使用Web服务器上的工作副本描述的方法,以便在尝试任何更复杂的操作之前习惯工作流程.

Subversion will not automatically push updates to your web server. You will need to pull them in with an update when you need to. It is possible to use what's called a "post-commit hook" to cause Subversion to execute a script when commits are made, and that script could update or export code to your production web server. However, you would need to write the script and it's kind of an advanced usage of Subversion. I would recommend trying out the method I described with a working copy on the web server to get accustomed to the workflow befrore trying anything more complicated.

附录如果您真的想这样做(除非您测试得好,否则我不推荐这样做),一种非常简单的方法是安排一个每次执行svn update的cron作业.在您的生产站点上需要几个小时(或几分钟).

Addendum If you really want to do this (and I don't really recommend it unless you really test well) a very easy method would be to schedule a cron job that does svn update every couple of hours (or minutes) on your production site.

不要忘记,如果您确实碰巧直接在Web服务器上修改了代码,则必须将其从那里提交回存储库,并对开发工作副本进行更新.

Don't forget that if you do happen to modify your code directly on the web server, you must commit it back to the repository from there, and do an update on your development working copy.

这篇关于现有目录的SVN设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆