How do I ignore a directory with SVN?

前端 未结 23 2595
无人共我
无人共我 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条回答
  •  礼貌的吻别
    2020-11-22 17:12

    Thanks for all the contributions above. I would just like to share some additional information from my experiences while ignoring files.


    When the folders are already under revision control

    After svn import and svn co the files, what we usually do for the first time.

    All runtime cache, attachments folders will be under version control. so, before svn ps svn:ignore, we need to delete it from the repository.

    With SVN version 1.5 above we can use svn del --keep-local your_folder, but for an earlier version, my solution is:

    1. svn export a clean copy of your folders (without .svn hidden folder)
    2. svn del the local and repository,
    3. svn ci
    4. Copy back the folders
    5. Do svn st and confirm the folders are flagged as '?'
    6. Now we can do svn ps according to the solutions

    When we need more than one folder to be ignored

    • In one directory I have two folders that need to be set as svn:ignore
    • If we set one, the other will be removed.
    • Then we wonder we need svn pe

    svn pe will need to edit the text file, and you can use this command if required to set your text editor using vi:

    export SVN_EDITOR=vi
    
    1. With "o" you can open a new line
    2. Type in all the folder names you want to ignore
    3. Hit 'esc' key to escape from edit mode
    4. Type ":wq" then hit Enter to save and quit

    The file looks something simply like this:

    runtime
    cache
    attachments
    assets
    

提交回复
热议问题