All cheatsheets

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-project
svn info

Show working copy or URL info: URL, revision, last-modified, etc.

svn info .

Everyday Work

svn update

Bring 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 postpone
svn status

Show working copy status: modifications, additions, deletions, untracked files.

-u show server out-of-date info; -v verbose; --quiet suppress untracked

svn status -u
svn 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.json
svn 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 diff

Show 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 --summarize
svn 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-x
svn 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 12345
svn merge --reintegrate <url>

Reintegrate a feature branch back into its source branch (legacy, pre-1.8).

svn merge --reintegrate ^/branches/feature-x
svn 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.txt

History & Inspect

svn log

Show commit log messages for files or the repository.

-r <rev1>:<rev2> range; -l <n> limit; -v verbose paths; --xml

svn log -l 20 -v
svn 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 -20
svn cat <url>[@rev]

Show the contents of a file at a given URL/revision without checking it out.

svn cat ^/trunk/README.md@HEAD

Properties & 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.png

Repository & Cleanup

svn cleanup

Clean up the working copy: remove lock tokens, fix timestamp, complete pending ops.

--diff3-cmd / --remove-unversioned untracked cleanup

svn cleanup /path/to/wc
svn 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.2
svn 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.com

Patch

svn diff > patch.diff

Produce a unified diff suitable for sharing or applying with svn patch.

svn diff > /tmp/feature-x.patch
svn 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.patch

Cheatsheet version 1.0.0

Covers SVN 1.10+