简体   繁体   English

SVN在导入期间忽略文件夹和文件

[英]SVN ignore folder and files during import

I need to use SVN in command line mode. 我需要在命令行模式下使用SVN。 The subversion that i'm using is 1.6. 我正在使用的颠覆是1.6。

I have this project to do the versioning for the first time: 我有这个项目第一次进行版本控制:

/myproj/a/fileA.txt  
/myproj/b/fileB.txt  
/myproj/c/fileC.txt  
/myproj/log/fileLOG1.txt  
/myproj/log/fileLOG2.txt  
/myproj/configure.txt  

I would like to import the project but I would like to exclude the directory log (with all contained files) and the configure file. 我想导入项目,但我想排除目录日志 (包含所有包含的文件)和配置文件。 How to exclude all directory content and the file and import only the files in folders a,b,c? 如何排除所有目录内容和文件,只导入文件夹a,b,c中的文件?

Thanks 谢谢

Assuming you already have a Subversion repository set up at some remote place, you could... 假设您已经在某个偏远的地方设置了Subversion存储库,您可以......

First create a new folder in your repository. 首先在存储库中创建一个新文件夹。 You can do this directly by specifying the folder by URL: 您可以通过URL指定文件夹来直接执行此操作:

svn mkdir --parents https://your.svn.server/folder/myproj/trunk

Creating a trunk directory is a good idea, so you'll have the project set up properly and can later create tags and branches directories besides trunk . 创建一个trunk目录是个好主意,所以你可以正确设置项目,以后可以创建除trunk之外的tagsbranches目录。 --parents tells Subversion to create intermediate directories if necessary. --parents告诉Subversion在必要时创建中间目录。

Then switch into your project folder and check out this new trunk folder: 然后切换到您的项目文件夹并检查这个新的trunk文件夹:

cd myproj
svn co https://your.svn.server/folder/myproj/trunk .

Add all folders you want to have under version control: 在版本控制下添加您想要的所有文件夹:

svn add a b c

And ignore files and folders you don't want to be under version control. 并忽略您不希望受版本控制的文件和文件夹。 This way they will not show up as local changes any more. 这样他们就不会再显示为本地更改了。

svn propedit svn:ignore .

This will open an editor (which one this is depends on how you configured Subversion). 这将打开一个编辑器(这取决于你如何配置Subversion)。 Each line contains an item to be ignored: 每行包含一个要忽略的项目:

configure.txt
log

Then save and exit the editor. 然后保存并退出编辑器。 Now check the status of your local working copy: 现在检查本地工作副本的状态:

svn status

This should show an A mark in front of items in your folders a , b , and c , indicating that these files and folders will be added. 这应该在文件夹abc的项目前面显示A标记,表示将添加这些文件和文件夹。 configure.txt and log should not be visible at all, because they are ignored. configure.txtlog根本不应该是可见的,因为它们会被忽略。

Now you can commit the first version of your project: 现在您可以提交项目的第一个版本:

svn commit -m "Added first version of my project"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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