SVN ignore like .gitignore

后端 未结 3 557
既然无缘
既然无缘 2021-01-29 23:24

In Git, if I have a project with lots of projects inside, let\'s suppose, a lot of Java projects, I can just create a .gitignore file in the root and it will \"be r

3条回答
  •  花落未央
    2021-01-30 00:09

    I solved this problem a slightly different way. This will only work if you're using a Bash shell and have Perl installed, but that's pretty much every Mac and Linux machine.

    Add the following to your .bashrc and .bash_profile files:

    alias _ss="svn status | egrep -v '`cat .svnignore|perl -p -e 's/\n/|/'`'"
    

    Don't forget to either restart your terminal or do:

    source ~/.bashrc
    (or .bash_profile if that's what you used)
    

    Now create a file called .svnignore, and put it in the directory where your repository is checked out.

    files/to/ignore
    another/file
    tmp
    node_modules
    

    Now when you run

    _ss
    

    in the root directory of your working copy, it will read the .svnignore file and ignore anything in it.

    I version the .svnignore file the same way I would version a .gitignore file.

    NOTE: This only affects the svn status command, and it won't prevent you from adding/committing ignored files.

提交回复
热议问题