SVN: Ignore some directories recursively

前端 未结 15 1290
粉色の甜心
粉色の甜心 2021-01-30 11:55

I don\'t want any directory named build or dist to go into my SVN no matter how deep in the tree it is.

Is this possible? In git I just put

相关标签:
15条回答
  • 2021-01-30 12:46

    As of subversion 1.8, there is now the svn:global-ignores property which works like svn:ignore but recursively (so set this on your top-level directory)

    0 讨论(0)
  • 2021-01-30 12:50

    This works for me:

     svn propset --recursive svn:ignore *.zip <dir_tree_with_no_zips>
    
    0 讨论(0)
  • 2021-01-30 12:50

    In order to ignore all such files in all repositories, you could add a global-ignores to your per-user configuration file.

    On Unix-like systems, this area appears as a directory named .subversion in the user's home directory. On Win32 systems, Subversion creates a folder named Subversion, typically inside the Application Data area of the user's profile directory

    See Configuration Options

    Unfortunately, there's no per-repository option to do this. It's basically per-user, or per-directory, so the multiple svn:ignores is probably the way to go, as annoying as it can be.

    0 讨论(0)
  • 2021-01-30 12:53

    svn propset takes --recursive as an option, so you can do this, with two downsides:

    1. you have to check out the entire repository (or at least all directories therein), and
    2. you have to remember to set the svn:ignore property whenever you add a new directory
    0 讨论(0)
  • 2021-01-30 12:55

    For example the folder structure:

    Project/
    Project/dist/
    
    cd Project
    svn propset svn:ignore '*' dist/
    svn ci -m "content of dist ignored"
    

    It's good to do a svn delete of dist content before the ignore command, so for branches dist will be empty.

    Worked for me, tested today. Here is the page explaining it a bit

    0 讨论(0)
  • 2021-01-30 12:55

    You first have to move to the top folder of your working copy and create a file there (say .svnignore) where you should place all the patterns that you want to be ignored, for example (for an Android project):

    bin
    gen
    proguard
    .classpath
    .project
    local.properties
    Thumbs.db
    *.apk
    *.ap_
    *.class
    *.dex
    

    Then you run the following command (remember that you must be at the top folder of your working copy):

    svn propset svn:ignore -R -F .svnignore .
    

    This will only work for folders and files that are not yet under version control. If you want a folder (or file) that is being versioned to start being ignored as well, remove it from version control by running the command:

    svn rm --keep-local <path>
    

    Got all this from this great article that explains it all: http://superchlorine.com/2013/08/getting-svn-to-ignore-files-and-directories/

    0 讨论(0)
提交回复
热议问题