48

Is there any way that I can ignore a file in my local working copy without polluting the svn properties? I don't want my local ignore pattern (e.g. temp files) being published to repository and cause repo having lots of useless information.

Just like in git, I can have .git/info/exclude. Is there any similar way in SVN?

Nanne
  • 64,065
  • 16
  • 119
  • 163
Adrian Shum
  • 38,812
  • 10
  • 83
  • 131

4 Answers4

32

You can put them into the changelist ignore-on-commit. See this question and its answer.

EDIT: This only works with tortoisesvn and possibly other clients, not with svn per se.

Community
  • 1
  • 1
Joey
  • 344,408
  • 85
  • 689
  • 683
  • 2
    Thanks. In fact I know this method, but ignore-on-commit only works with svn 1.5+, and not every client is supporting it (e.g. Subclipse). – Adrian Shum Jul 26 '10 at 10:43
  • Though this method don't really suit my need but I think it is the best and most official answer for SVN. Thanks :) – Adrian Shum Jul 28 '10 at 04:10
  • 1
    Ignore-on-commit will not be published to other clients. [official reference](http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-changelists.html) – Nickolas Nov 26 '13 at 14:43
  • 1
    @Nickolas, **local** to working copy implies exactly that, yes. – Joey Nov 26 '13 at 14:45
  • 1
    The other question and answer you reference point out that ignore-on-commit does its magic only for the Tortoise GUI ... the svn command line will still, unfortunately, try to commit the files. – Roger Jan 06 '15 at 06:10
15

Yes there is. Goto TortoiseSvn Setting -> General.

There is a global ignore edit box. Add the following as a good starting point to ignore items you do not want to go into the repository:

*.fbl6 *.fbpInf *.fb6lck *.*scc *.aps *.bak *.cache *.eto *.ilk *.ncb *.obj *.patch *.pch *.plg *.rdl.data *.sbr *.sqlsuo *.suo *.svclog *.tlh *.tli *.tmp *.user *.vshost.* *DXCore.Solution [Bb]in [Dd]ebug [Oo]bj [Rr]elease _[Rr]e[Ss]harper.* _UpgradeReport_Files Ankh.Load Backup* CVS PrecompiledWeb svnignore[.-] [Tt]humbs.db UpgradeLog*.* _vti_* lint.db
Joey
  • 344,408
  • 85
  • 689
  • 683
Simon Hughes
  • 3,534
  • 3
  • 24
  • 45
  • 6
    Oh Yes! I almost forgot that the "global" ignore list is in fact "local" ("local" in the sense it is kept local and not synced to svn). Thanks for reminding me for this! :) However it effects on all working copies, for which I may want that file to ignore in one working copy but not in another. – Adrian Shum Jul 26 '10 at 10:50
  • 1
    I found this looking for how to ignore foo.vshost.exe - the pattern having `.vshost.` doesn't seem to work, I've now found that `*.vshost.*` works. – Greg Domjan Jun 29 '11 at 19:40
6

This technique is more like .gitignore than .git/info/excludes (Managing svn:ignore with impunity):

  • Create a .svnignore in the top of your project.
  • Make a list of files/wildcards you care to ignore
  • Save it

Now, from the top of your project, you can do:

$ svn propset svn:ignore -F .svnignore  .

At least this way you have to make just 1 propset change.

You'll still have to either track or ignore your .svnignore (just like .gitignore).

sam
  • 40,318
  • 2
  • 41
  • 37
4

If you want to avoid downloading a remote directory completely, the following works:

svn update --set-depth exclude <folder-to-ignore>

emragins
  • 4,607
  • 2
  • 33
  • 48
  • 1
    This only works in order to *not download a remote directory* (e.g. I work on `local/widgets`, don't care to have `local/largelibrary`, I can set depth to exclude on largelibrary from local: largelibrary won't be ever synced, and conflicts will arise if I ever create it locally). Upvoting, since this is exactly my use case, where the other answers don't apply. – LSerni Apr 06 '16 at 08:30
  • Thanks for pointing that out, @Iserni. I believe that was my use-case as well where the repository was quite large and had many folders I simply didn't care about. I've added that explanation into the answer. – emragins Apr 06 '16 at 17:00
  • this has absolutely nothing to do with the question – Kip Oct 20 '16 at 16:21
  • I landed at this question while looking for a way to do exactly what is described in this answer. – Sepster Nov 16 '18 at 00:59