“不可能只签出一个文件。你能做的最好的签出级别是在目录级别。”

在使用Subversion时,我如何解决这个问题?

我们在Subversion中有这个文件夹,用来保存所有的图像。我只是想从其中找出一个文件(图像)。这个文件夹真的很大,里面有很多我现在不需要的东西。


当前回答

你可以这样做:

mkdir <your directory>/repos/test

svn cat http://svn.red-bean.com/repos/test/readme.txt > <your directory>/repos/test/readme.txt

基本上,这个想法是创建您想从SVN中获取文件的目录。 使用svn cat命令将输出重定向到同名文件。默认情况下,cat将在stdio上转储信息。

其他回答

If you want to view readme.txt in your repository without checking it out: $ svn cat http://svn.red-bean.com/repos/test/readme.txt This is a README file. You should read this. Tip: If your working copy is out of date (or you have local modifications) and you want to see the HEAD revision of a file in your working copy, svn cat will automatically fetch the HEAD revision when you give it a path: $ cat foo.c This file is in my local working copy and has changes that I've made. $ svn cat foo.c Latest revision fresh from the repository!

你可以这样做:

mkdir <your directory>/repos/test

svn cat http://svn.red-bean.com/repos/test/readme.txt > <your directory>/repos/test/readme.txt

基本上,这个想法是创建您想从SVN中获取文件的目录。 使用svn cat命令将输出重定向到同名文件。默认情况下,cat将在stdio上转储信息。

如果您真的需要更新,可以将该文件包含在另一个文件夹的签出中。

从SVN 1.6开始就可以使文件外部化,一种SVN链接。这意味着您可以拥有另一个包含单个文件的版本化文件夹。还可以在签出此文件夹时向文件提交更改。

这非常简单,签出您想要包含文件的文件夹,并简单地向文件夹添加一个属性

svn propedit svn:externals .

内容如下:

file.txt /repos/path/to/file.txt

提交后,该文件将出现在文件夹的未来签出中。基本上它可以工作,但有一些限制,如上面链接的文档所述。

cd C:\path\dir
svn checkout https://server/path/to/trunk/dir/dir/parent_dir--depth empty
cd C:\path\dir\parent_dir
svn update filename.log

(编辑filename.log)

svn commit -m "this is a comment."

你可以分两步完成:

只使用元信息检出一个空的SVN存储库: $ CD /tmp $ SVN co——depth empty http://svn.your.company.ca/training/trunk/sql 执行svn up命令更新指定文件: $ svn up http://svn.your.company.ca/training/trunk/sql/showSID.sql