How do I ignore a directory with SVN?

前端 未结 23 2347
无人共我
无人共我 2020-11-22 16:42

I just started using SVN, and I have a cache directory that I don\'t need under source control. How can I ignore the whole directory/folder with SVN?

I am using Vers

相关标签:
23条回答
  • Solved with Eclipse in the next way:

    First of all, do a synchronisation of your folder to the project:

    team -> synchronise

    In the next view, team view, you can see all resources that you can commit to the SVN server.

    So, select the resource folder of the resource that you want to ignore, and then you can ignore it using

    team -> add to svn:ignore.

    After that, in the confirmation window, do select the first option: "ignore by name".

    For instance, If I want to ignore the target folder and their .class resources, I'll do synchronise, and in the synchronise view, I'll select the target folder. After that, I'll select

    team->add

    to svn:ignore and then I'll confirm the first option in the confirm window.

    0 讨论(0)
  • 2020-11-22 17:32

    ...and if you want to ignore more than one directory (say build/ temp/ and *.tmp files), you could either do it in two steps (ignoring the first and edit ignore properties (see other answers here) or one could write something like

    svn propset svn:ignore "build
    temp
    *.tmp" .
    

    on the command line.

    0 讨论(0)
  • 2020-11-22 17:32

    Watch your trailing slashes too. I found that including images/* in my ignore setting file did not ignore ./images/. When I ran svn status -u it still showed ? images. So, I just changed the ignore setting to just images, no slashes. Ran a status check and that cleared it out.

    0 讨论(0)
  • 2020-11-22 17:35

    Here's an example directory structure:

    \project
        \source
        \cache
        \other
    

    When in project you see that your cache directory is not added and shows up as such.

    > svn st
    M  source
    ?  cache
    

    To set the ignore property, do

    svn propset svn:ignore cache .

    where svn:ignore is the name of the property you're setting, cache is the value of the property, and . is the directory you're setting this property on. It should be the parent directory of the cache directory that needs the property.

    To check what properties are set:

    > svn proplist
    Properties on '.':
      svn:ignore
    

    To see the value of svn:ignore:

    > svn propget svn:ignore
    cache
    

    To delete properties previously set:

    svn propdel svn:ignore
    
    0 讨论(0)
  • 2020-11-22 17:35

    Important to mention:

    On the commandline you can't use

    svn add *
    

    This will also add the ignored files, because the command line expands * and therefore svn add believes that you want all files to be added. Therefore use this instead:

    svn add --force .
    
    0 讨论(0)
提交回复
热议问题