现有目录的 SVN 设置
我一直在查看文档等并且让 SVN 正常工作,但我想将其放在现有目录中。我导入了该目录,那么我是否要重命名/删除非 SVN 目录,然后将 SVN 检出到非 SVN 目录位置?我只是想了解如何让它开始发布到我们的网站 URL。
如果是这样,有没有办法保留当前的非SVN并使其成为SVN而不是导入并覆盖?
谢谢,我正在尝试了解 SVN,但发现网上很多教程之类的内容令人困惑。
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.
If so, is there any way to keep the current non SVN and make it SVN rather than import and overwrite?
Thanks, I am trying to understand SVN, but find a lot of the tutorials and such on the web to be confusing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,你确实有。将代码添加到存储库后,您可以删除或重命名原始代码目录。然后将项目从存储库检出到与之前的代码相同的位置,并从那里继续工作。
更新
要使您的网站从存储库更新,您实际上需要两个工作目录和一个存储库。
存储库:存储库存储代码和变更集,但不能作为文件系统直接访问。保留备份!
工作目录 1:您可以在从存储库中签出的工作目录中开发和测试代码。将更改提交回存储库。
工作目录 2:重命名网络服务器上的代码目录。将代码的副本检出到您的网络服务器的相应位置。从技术上讲,它现在是一个工作目录,因为它包含
.svn
元数据目录,尽管您通常不会在此处进行更改。从开发工作目录 (1) 更改代码并将其提交回存储库。当您对它们正常工作并经过适当测试感到满意时,请在 Web 服务器的代码副本 (2) 上执行
svn update
(或者,如果您在 Web 服务器上使用 Tortoise SVN,请执行更新)。这将使服务器代码与当前开发版本同步。Subversion 不会自动将更新推送到您的网络服务器。您需要在需要时通过更新来拉取它们。可以使用所谓的“提交后挂钩”让 Subversion 在提交时执行脚本,并且该脚本可以更新代码或将代码导出到您的生产 Web 服务器。但是,您需要编写脚本,这是 Subversion 的高级用法。我建议尝试我在网络服务器上使用工作副本描述的方法,以便在尝试任何更复杂的操作之前习惯工作流程。
附录如果你真的想这样做(我真的不推荐它,除非你真的测试得很好)一个非常简单的方法是安排一个 cron 作业来执行
svn update 在您的生产站点上每隔几个小时(或几分钟)执行一次。
不要忘记,如果您确实直接在 Web 服务器上修改了代码,则必须将其从那里提交回存储库,并对您的开发工作副本进行更新。
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.
UPDATE
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!.
Working directory 1: You develop and test your code from a working directory checked out from the repository. Commit changes back to the repository.
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.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 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.
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.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.