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 respected" in the entire repository.
How can I do this for an SVN project?
For example, how can I make an "svn ignore" setup (via cmd line) for a .gitignore
like the following?
*.class
*.jar
*.war
*.ear
target/
.classpath
.settings/
.project
.metadata
bin/
The most important part of the question: How can I make it work to new folders inside the root? Example:
I ran svn propset svn:ignore "*.class" . -R
in my root and commit. Ok:
root
- folder1/
-- *.class (ignored)
-- other files (ok)
- folder2/
-- *.class (ignored)
-- other files (ok)
Now, I create folder 3. The previous svn:ignore
settings will not apply, right? Is there a way to make it so?
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:Don't forget to either restart your terminal or do:
Now create a file called .svnignore, and put it in the directory where your repository is checked out.
Now when you run
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.
You can use
svn:ignore
. You generally need to tell SVN to apply special properties to the files:(Note the dot at the end of the command.)
For multiple files you can add a newline character.
Type exactly like here with line breaks:
Check that the files are ignored:
Then commit the code.
And yes, many duplicate questions are already available.
You can refer my favorite svn cheatguide.
You can create a file,
svn-ignore.txt
, with your ignored files and directories:Now try the following:
-R
is for recursive.