65

I am being forced to work with Subversion on a current project.

Someone has unkindly added the bin and obj folders to the repository.

Other than removing them, and committing the removal, is there an equivalent of .gitignore file I can add to the repository to make the guilty party in the development team never add them again?

I know I can alter my own global ignore pattern, but ideally I'd like the whole development team to be able to share this on a project level.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Alex
  • 37,502
  • 51
  • 204
  • 332

5 Answers5

31

This is done by a svn:ignore property in SVN. This property can be added to a folder. Let us imagine the following:

 +-- root
       +-- bin
       +-- ...

to ignore the bin folder you have to set the svn:ignore property onto the root folder. First change into the root folder and do the following on command line:

svn propset svn:ignore "bin" .

Or you can do this via TortoiseSVN on Windows (file->properties->Subversion Tab).. Further reading in the Subversion book.

khmarbaise
  • 92,914
  • 28
  • 189
  • 235
  • 5
    Maybe most won't be as unobservant as me, but if it's failing with an error like "explicit target required" you're probably missing the `.` at the end of the command like I did... – Harvey Adcock Aug 11 '16 at 19:01
15

I have just started with Android Studio and I ended up editing the svn:ignore property in the GUI. I used the Edit Properties in the Subversion menu and added a whole bunch of ignores which were mentioned in other posts.

enter image description here

Below is what I ignored and Android Studio marked these visually with different colour after I edited the property.

# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin
gen
gradle

# Local configuration file (sdk path, etc)
local.properties

# Eclipse project files
.classpath
.project

# Android Studio
.idea
.gradle
local.properties
out
build
production
*.iml
*.iws
*.ipr
*~
*.swp
theczechsensation
  • 4,215
  • 2
  • 24
  • 25
6

Use:

svn propset svn:ignore 'file you want to ignore'

See Properties.

Also check out the global-ignores configuration option.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sergey Eremin
  • 10,994
  • 2
  • 38
  • 44
5

If you are working with TortoiseSVN, this can be accomplished by:

  • Right click bin directory -> TortoiseSVN -> add to ignore list -> bin

When you commit, your root or trunk directory will be highlighted. You can also ignore multiple files at the same time by selecting them then

  • Right click -> TortoiseSVN -> add to ignore list -> ignore X items by name.
River
  • 133
  • 1
  • 8
1

I prefer to hide status items instead of use svn:ignore. To do it I've created a .svnignore file with patterns that I want to ignore and this alias:

alias svn-status='svn st * 2>&1 | grep -v "$(cat .svnignore)"'
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
19WAS85
  • 2,853
  • 1
  • 20
  • 19