When i exclude files from SVN with svn:ignore
and then another person try to commit the files excluded, svn block him? or he have to do the same command in his computer?
Imagine if you have a bunch of Java files (*.java
). These get compiled into *.class
files. The compiled *.class
files should not be stored in Subversion.
Now, imagine a developer who created a bunch of new *.java
files, compiled them, was happy with the results, and did this:
$ svn add *
In this case, Subversion will merrily add in all the compiled *.class
files. Not what you want...
The svn:ignore
property goes on the directory where you want to ignore files. If, and only if a file is not already in Subversion, the file won't show up if the file matches the svn:ignore
glob pattern on the file, and the user does a svn status
or an svn add
with wild cards.
With the svn status
command, these files won't show up with a ?
mark at the beginning of the lines of output. If a user attempts to add with a wildcard, Subversion will ignore these files.
In the above scenario, if a developer did this:
$ svn add *
The svn:ignore
property will prevent the *.class
files from being added.
However, if a user specifically adds an ignored file:
$ svn add foo.class
Then, Subversion won't ignore the file. And, once it is added to the repository, Subversion will report on it if the file is changed or deleted.
The svn:ignore
property is visible to all users who have checked out that version of the directory. It's a great way to prevent accidental additions of files, but it can't prevent someone from actually adding them.
I have a pre-commit hook that can take things a step further. With it, you can prevent users from adding specific files into the repository. You can also force users to set a svn:ignore
when they create a new directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With