简体   繁体   中英

SVN ignore folder and files during import

I need to use SVN in command line mode. The subversion that i'm using is 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?

Thanks

Assuming you already have a Subversion repository set up at some remote place, you could...

First create a new folder in your repository. You can do this directly by specifying the folder by 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 . --parents tells Subversion to create intermediate directories if necessary.

Then switch into your project folder and check out this new trunk folder:

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). 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. configure.txt and log should not be visible at all, because they are ignored.

Now you can commit the first version of your project:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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