如何在SVN中更新文件? [英] How to update a file in SVN?

查看:123
本文介绍了如何在SVN中更新文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我更新 SVN 存储库中文件的命令.文件已经导入了,我只是想修改一下.

文件是 main.css 和文件路径 /home/weblab/public_html/cake_1_2/app/webroot/css.

谁能给我确切的命令?

解决方案

我猜您已经使用svn import"将文件导入存储库.如果是这种情况,那么您在磁盘上的本地文件不是工作副本的一部分,您将无法svn commit"它.

为了验证这一点,请从您的代码所在的目录运行 svn info.如果它显示:svn: '.'不是工作副本,您当前的目录不是工作副本.

然后你需要做的是:

  1. svn checkout 您的项目从存储库到本地工作副本(临时目录).
  2. 将您对现有文件的更改复制到工作副本上
  3. svn commit 那些改变.

完成此操作后,重命名原始项目位置(您现在工作的位置)并将工作副本移动到该位置.您现在可以像往常一样从您的工作副本中svn commit.

如果您现在使用的文件夹名为:/home/username/myproject,而工作副本名为 /tmp/workingcopy.然后你可以输入以下内容:

  1. mv/home/username/myproject/home/username/myproject.old
  2. mv/tmp/workingcopy/home/username/myproject

现在继续在 /home/username/myproject 中工作,如果您确定所有代码都在 svn 存储库中,则可以删除 myproject.old>

Can anyone tell me the command for updating a file in the SVN repository. The file is already imported, I just want to modify the changes.

The file is main.css and the filepath /home/weblab/public_html/cake_1_2/app/webroot/css.

Can someone give me the exact command?

解决方案

I'm guessing that you have used "svn import" to get the files into the repository. If that is the case, then your local file on disk is not part of a working copy and you will not be able to "svn commit" it.

In order to verify this, run svn info from the directory your code is in. If it says: svn: '.' is not a working copy, your current directory is not a working copy.

What you then need to do is:

  1. svn checkout your project from the repository to a local working copy (temporary directory).
  2. copy your changes to the existing files over the working copy
  3. svn commit those changes.

After you've done that, rename the original project location (where you were working now) and move the working copy in it's place. You can now svn commit as normal from your working copy.

If the folder you use now is called: /home/username/myproject and the working copy is called /tmp/workingcopy. Then you could type the following:

  1. mv /home/username/myproject /home/username/myproject.old
  2. mv /tmp/workingcopy /home/username/myproject

Now continue your work in /home/username/myproject, you can delete myproject.old if you are sure all of your code is in the svn repository

这篇关于如何在SVN中更新文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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