SVN Commands Cheat Sheet
Quick reference for Subversion (SVN) commands: checkout, update, commit, branch/tag, merge, history inspection and repository administration, with common options and practical examples.
28 commands
Getting Started
svn checkout <url> [<dir>]Check out a working copy from a repository; the first time you fetch project files.
-r <rev> specific revision; --depth empty|files|immediates|infinity
svn checkout https://svn.example.com/repo/trunk ./my-projectsvn infoShow working copy or URL info: URL, revision, last-modified, etc.
svn info .Everyday Work
svn updateBring your working copy in sync with the repository; may merge server changes.
-r <rev> update to a specific revision; --accept postpone|base|mine-full|theirs-full|edit|launch
svn update --accept postponesvn statusShow working copy status: modifications, additions, deletions, untracked files.
-u show server out-of-date info; -v verbose; --quiet suppress untracked
svn status -usvn add <path>Schedule a file or directory to be added on the next commit.
-N non-recursive (directory only); --force add already-versioned
svn add src/utils/ helpers/svn delete <path>Remove a file or directory from the working copy and schedule deletion on the next commit.
--keep-local keep the file in working copy (no removal on server)
svn delete obsolete/old-config.jsonsvn commit -m "<msg>"Send local changes to the repository with a log message.
-m inline message; -F <file> read message from file; --no-unlock keep locks
svn commit -m "feat: add login form validation"svn diffShow unified diff between paths or revisions.
-r <rev1>:<rev2> compare revisions; -c <rev> changes made in a revision; --diff-cmd / -x
svn diff -r HEAD~5:HEAD --summarizesvn revert <path>Discard local edits and restore the file/directory to its pristine state.
-R recursive; --depth infinite
svn revert -R .Branching & Tags
svn copy <src> <dst>Create a branch or tag by copying in the repository (cheap copy).
-r <rev> copy from a specific revision; -m message
svn copy ^/trunk ^/branches/feature-x -m "branch: feature-x"svn switch <url>Switch the working copy to point at a different branch/tag without re-checking out.
-r <rev> switch to a specific revision; --relocate rewrite URL prefix
svn switch ^/branches/feature-xsvn list <url>List entries in a repository directory without checking them out.
-v verbose; -r <rev>
svn list -v ^/tags/Merging & Conflict
svn merge <url[@rev]>Apply the differences between two sources/branches into your working copy.
-c <rev> / -r <rev1>:<rev2> revisions to merge; --record-only merge tracking only
svn merge ^/trunk -c 12345svn merge --reintegrate <url>Reintegrate a feature branch back into its source branch (legacy, pre-1.8).
svn merge --reintegrate ^/branches/feature-xsvn resolve <path>Resolve conflicted files after a merge/update.
--accept base|mine-full|theirs-full|working|theirs-conflict|theirs-full
svn resolve --accept theirs-full conflict.txtHistory & Inspect
svn logShow commit log messages for files or the repository.
-r <rev1>:<rev2> range; -l <n> limit; -v verbose paths; --xml
svn log -l 20 -vsvn blame <file>Show the author and revision for each line in a file (praise / annotate).
-r <rev> annotate as of revision; -v include revision text
svn blame src/index.ts | tail -20svn cat <url>[@rev]Show the contents of a file at a given URL/revision without checking it out.
svn cat ^/trunk/README.md@HEADProperties & Locks
svn propset <prop> <value> <path>Set a property on a file or directory (e.g., svn:ignore, svn:executable, svn:mime-type).
-F <file> value from file; --revprop repository revprop
svn propset svn:ignore "node_modules\n.DS_Store" .svn propedit <prop> <path>Open the property value in an editor to change it.
svn propedit svn:ignore .svn lock <target>Lock files so no other client can commit changes (requires server config).
-m "reason"; --force steal lock
svn lock images/banner.png -m "editing before release"svn unlock <target>Release a lock on a file or directory.
--force break another's lock
svn unlock images/banner.pngRepository & Cleanup
svn cleanupClean up the working copy: remove lock tokens, fix timestamp, complete pending ops.
--diff3-cmd / --remove-unversioned untracked cleanup
svn cleanup /path/to/wcsvn export <url> [<dir>]Export a clean directory tree (without .svn metadata) — useful for packaging.
-r <rev> specific revision; --force overwrite existing
svn export ^/tags/v1.2.0 ./release-1.2svn import <path> <url> -m "<msg>"Add an unversioned tree to the repository as a single initial commit.
--no-ignore include ignored files; --auto-props apply auto-props
svn import ./src ^/trunk -m "initial import"svn relocate <from-prefix> <to-prefix>Rewrite the repository URL prefix stored in the working copy (server moved).
--strict reject non-matching prefix
svn relocate https://old.svn.example.com https://new.svn.example.comPatch
svn diff > patch.diffProduce a unified diff suitable for sharing or applying with svn patch.
svn diff > /tmp/feature-x.patchsvn patch <patch-file>Apply a unified diff generated by svn diff to the working copy.
--dry-run preview; --reverse-cmd
svn patch --dry-run /tmp/feature-x.patchCheatsheet version 1.0.0
Covers SVN 1.10+