Configuring the SVN Local Global Ignore Pattern
Every team that manages code with SVN knows the awkward moment: you run svn status and dozens of files that should never be versioned stare back at you — node_modules, __pycache__, .idea, .DS_Store. One careless svn add -A later, the whole lot is committed, the repository bloats, and every checkout drags the junk along. The Global ignore pattern closes that gap: configure it once in your SVN client and every working copy on your machine automatically ignores those files.
Where to configure it
The most common entry point is the TortoiseSVN GUI client:
Settings → General → Global ignore pattern
Type the rules into the box, separated by spaces. TortoiseSVN ships with a default set, but it is usually not enough — you will want to extend it.
If you prefer the command line, SVN keeps the global ignores in the client configuration file: ~/.subversion/config on Linux/macOS, %APPDATA%\Subversion\config on Windows. Open the file, locate the [miscellany] section, uncomment the global-ignores line, and set it to:
global-ignores = *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo *.rej *~ #*# .#* .*.swp .DS_Store obj Obj bin Bin Debug debug *.suo *.tmp *.user *.log *.pdb *.refresh .idea node_modules .git packages TestResults .project .settings
After saving, newly created working copies pick up the rules immediately; existing checkouts pick them up the next time the client is opened.
One extra point: TortoiseSVN reads and writes the very same config file, so changes in the GUI and on the command line affect each other — the GUI is just more approachable for colleagues who are not used to the config format.
Recommended global ignore rules
The following is a practical set of global ignore rules covering build artifacts, system files, and files generated by development tools:
*.o *.al .libs *.so.[0-9]* *.a *.pyc *.pyo *.rej *~ #*# .#* .*.swp .DS_Store obj
Obj bin Bin Debug debug *.suo *.tmp *.user *.log *.pdb *.refresh .idea
node_modules .git packages TestResults .project .settings
Rule explanation
- Build artifacts:
*.o,*.a,*.libs,*.so.[0-9]*are intermediate objects and libraries generated by C/C++ compilation; - Python caches:
*.pyc,*.pyoare Python bytecode caches (Python 3 also creates__pycache__directories — add them too); - Editor/system temporary files:
*~,#*#,.#*,*.swpare editor temporary files, and.DS_Storeis the macOS folder metadata file; - Dev tool directories:
.idea(JetBrains IDEs),.settings(Eclipse),node_modules(Node.js dependencies),packages,TestResults, etc.; - Logs and temporary files:
*.log,*.tmp,*.user,*.refresh,*.pdb, etc.
A concrete example
Say you maintain a project that mixes a Node.js backend, Python scripts, and Java tests. Before configuring anything, svn status shows node_modules/ (tens of thousands of files), __pycache__/, .idea/, and a pile of *.log. Once the rules above are in place, all of that disappears from the status list, which now shows only the source files you actually changed — and svn add -A becomes safe again. For polyglot projects, a machine-wide global-ignores is far less tedious than writing svn:ignore by hand in every repository.
The team scenario is even more typical: a team moved from solo maintenance to three-person collaboration, and the first svn commit pushed up a 500MB node_modules. After svn rm --keep-local node_modules removed the dependency from the repository and the ignore rules were added, the repo size returned to normal and teammates' checkout time dropped from over ten minutes to a few seconds. In Git this is .gitignore; in SVN it is global-ignores combined with svn:ignore.
Notes
- The Global ignore pattern takes effect globally on your machine and applies to all working copies;
- It only affects files not yet under version control. Files already
svn add-ed or committed will not be ignored by this rule — so configure it early, before the damage is done; - If an ignored file must be committed, use
svn add --forceto add it explicitly, or temporarily adjust the ignore rules; - For ignore rules shared by a team, configure the versioned
svn:ignoreproperty on the repository root so all collaborators get the same behavior. From the command line:
svn propset svn:ignore "node_modules
__pycache__
*.log" .
svn commit -m "set svn:ignore"
Summary
Filling the SVN Global ignore pattern with rules such as *.o *.a *.pyc *.pyo *.log node_modules .idea .git prevents build artifacts and IDE configuration from being committed repeatedly, keeping the repository clean. For more version control and development workflow content, see the developer tools category, such as Git workflow for website development and Git deployment workflow; for teams migrating from SVN to Git, see upgrading SVN to 1.8 on CentOS.
Reference: SVN's official documentation on configuration files is the "Runtime Configuration Area" chapter at https://svnbook.red-bean.com/en/1.8/svn.advanced.confarea.html.
Original post: https://www.cnblogs.com/cqzhuomi/articles/17284339.html (cnblogs.com CQZHUOMI, repost)
Integration & Code Examples
Example 1: Setting svn:global-ignores
# 1) Set it on the directory that should cover everything below it
cd /path/to/repo
svn propedit svn:global-ignores . --editor-cmd vim
# Write one pattern per line (case sensitive, * and ? are wildcards):
# *.o
# *.pyc
# *.log
# node_modules
# .idea
# 2) Confirm which path holds the property and what it currently says
svn propget svn:global-ignores . -v
# 3) Property changes only reach the team once committed
svn commit -m "chore: add svn:global-ignores for build artifacts"
Beyond the pattern list, check the path the property lives on: set it at the wrong level and subdirectories inherit nothing.
Example 2: Comparing svn status with --no-ignore
# By default only changes that would be committed are listed
svn status
# --no-ignore also lists ignored entries, which is where ? versus I becomes visible
svn status --no-ignore | head -n 30
# Ignored but still tracked: ignore patterns never affect tracked files
svn status --no-ignore | awk '$1 == "I" {print $2}' | while read -r f; do
svn info "$f" >/dev/null 2>&1 && echo "tracked-but-ignored: $f"
done
# To actually remove it from the repository while keeping the local file
# svn delete --keep-local path/to/artifact
When something keeps getting committed anyway, run --no-ignore first and confirm whether the file is already tracked; those two checks explain most cases.
Where Each of the Three Ignore Mechanisms Applies
SVN offers three places to declare ignore rules, each with a different scope and sharing model. Picking the wrong one is the usual reason rules "do not reach the team".
| Mechanism | Scope | Shared on commit | Client requirement | Entry point |
|---|---|---|---|---|
global-ignores |
Every working copy on this machine | No, local config only | Any client | [miscellany] in ~/.subversion/config |
svn:ignore |
The directory holding the property, not recursive | Yes, the property travels with commits | A standard client | svn propset svn:ignore |
svn:global-ignores |
The property path and all subdirectories | Yes, the property travels with commits | 1.8 or later | svn propedit svn:global-ignores |
Work in this order: build artefacts that only matter on your own machine go to global-ignores; rules the whole team must share go to a versioned property; only when an entire subtree should inherit the same set is svn:global-ignores the right pick.
global-ignores and the TortoiseSVN dialog read and write the same config file, so edits are visible from both sides; there is no case where the GUI setting is invisible to the command line.
Property rules must sit at the right level: at the repository root they cover everything, in a subdirectory they cover only that subtree, and a misplaced property is never read by directories below it.
How Directory Names and Wildcards Match
global-ignores separates patterns with spaces, so a pattern containing a space is split in two; matching a space requires escaping.
Leave the trailing slash off directory names. node_modules matches the whole subtree, while node_modules/ is treated as an exact path and matches one level only.
The example rule list spells out obj and Obj, bin and Bin, Debug and debug because exported directory names differ in case across platforms, so both spellings have to be covered.
Only * and ? are available as wildcards. *.so.[0-9]* covers versioned library files, but it will not recurse into subdirectories for you — recursion is what the svn:global-ignores property provides.
Limitations
- If an ignored file must be committed, use
svn add --forceto add it explicitly, or temporarily adjust the ignore rules; 4. - This article reflects public information as of 2023-04-03; terms, prices and quotas follow the provider's current published terms.
- Third-party capability and limit statements follow their official documentation; no further commitment is implied here.
- Licensing, filing and data-residency decisions must be verified against the regulations of your operating region.
FAQ
Should a team use svn:ignore or global-ignores?
Teams share svn:ignore; global-ignores is a local convenience. The property is versioned and applies to everyone after a commit, while the pattern sits in each client config file and never syncs to teammates. Both only touch untracked files, and a name with a trailing slash matches 1 exact path instead of a subtree.
Which SVN version does svn:global-ignores require?
SVN 1.8 or newer, and the property must be committed before subdirectories inherit it. The classic global-ignores line needs only the client config file; TortoiseSVN's dialog edits that same file, so GUI and command line write to one place. Mixed client versions break inheritance, so standardise first.
Why does a configured ignore pattern not apply?
Run svn status --no-ignore and read the 2 flags first. Files already committed never disappear through an ignore rule; move them out with svn delete --keep-local and commit. A trailing slash turns a name into an exact path match, so drop it to cover the whole subtree.
When shouldn't ignore rules be the only control?
For files already in the repository. Patterns only affect untracked paths, so history and repository size stay unchanged and every artifact stays in the log. svn add --force can override a rule once, but leaning on it as routine practice leaves 1 fragile workflow where the pattern is decorative.
Related Providers
- Apache Subversion: when the svn:global-ignores property must be told apart from client-side global-ignores and inheritance scope confirmed.
- JetBrains: when the team edits files in IntelliJ IDEs and the IDE ignore list must match the svn patterns.
- Eclipse: when the working copy runs through Eclipse with Subclipse and ignored resources are maintained in the IDE.
Community & Resources
Official docs and communities
- The svn:global-ignores property — Inheritance rules and wildcard syntax for global ignores.
- Client runtime configuration — How local and global ignore patterns differ, and where the config lives.
- Apache Subversion project — Release notes and download entry points.
Learning resources and tools
- Subversion documentation — The official index of command references and release notes.
- Subversion FAQ — Common questions about properties, ignores, and working copies.
- Binary packages — Where to get clients per platform so the team stays on one version.
Original source: cnblogs.com (CQZHUOMI) ↗