SVN Commands
What is Svn
SVN stands for Subversion. It is a centralized version control system distributed under an open-source Apache license. SVN allows multiple developers to have the current and recent versions of data, such as source files, in sync. It keeps track of every change users make on files.
Checkout the project repository
svn checkout (co) — Check out a working copy from a repository.
$ svn checkout <svn_repository_url> svn co <svn_url>
Show Information
svn info — Display information about a local or remote item.
svn info
Check status
svn status
(stat, st) — Print the status of working copy files and directories.
$ svn status
Add changes
svn add —
Add files, directories, or symbolic links.
$ svn add
file1.js
Add a directory
The default behavior of adding a directory is to recurse.
$ svn add testdir/
A testdir
A testdir/a
A testdir/b
A testdir/c
A testdir/d
Add multiple files and directories in a single shot
Add multiple files
svn add file1.txt file2.txt file3.txt
Add multiple directories
svn add dir1 dir2 dir3
Add multiple files and directories together
svn add file1.txt file2.txt dir1 dir2
Move file or directories
svn move (mv)
— Move a file or directory.
Move a file
$ svn move foo.c bar.c
A bar.c
D foo.c
Move several files in your working copy into a subdirectory
$ svn move baz.c bat.c qux.c src
A src/baz.c
D baz.c
A src/bat.c
D bat.c
A src/qux.c
D qux.c
Move a directory
svn move dir1 new_dir1
Or move inside another directory
svn move dir1 dir3/dir1
Move several directories
Unfortunately, the svn move command does not support moving multiple directories with a single command like it does with multiple files. Each move operation in SVN needs to be executed individually. However, you can streamline the process using a script to handle multiple moves in a single execution.
Delete changes
svn delete (del, remove, rm)
— Delete an item from a working copy
Delete a file
$ svn delete myfile
D myfile
$ svn commit -m "Deleted file 'myfile'."
Deleting myfile
Transmitting file data .
Committed revision 14.
Deleting by keeping at local
Use the --keep-local option to override the default svn delete behavior of also removing the target file that was scheduled for versioned deletion. This is helpful when you realize that you've accidentally committed the addition of a file that you need to keep around in your working copy, but which shouldn't have been added to version control.
$ svn delete --keep-local conf/program.conf
D conf/program.conf
Commit changes
svn commit (ci)
— Send changes from your working copy to the repository.
Commit all the changes
Commit a simple modification to a file with the commit message on the command line and an implicit target of your current directory (“.”):
$ svn commit -m "added howto section."
Sending a
Transmitting file data .
Committed revision 3.
Commit changes of a particular directory
$ svn commit ./module1 -m "Add module 1"
Revert changes
svn revert
— Undo all local edits.
$ svn revert foo.c
Reverted foo.c
Revert a whole directory of files
$ svn revert --depth=infinity src/
Reverted src/newdir/afile
Reverted src/foo.c
Reverted src/bar.txt
$ svn add mistake.txt whoops
A mistake.txt
A whoops
A whoops/oopsie.c
$ svn revert mistake.txt whoops
Reverted mistake.txt
Reverted whoops
$ svn status
? mistake.txt
? whoops
Update repository
svn update (up)
— Update your working copy.
svn update
Subscribe to my newsletter
Read articles from Abhishek Dandriyal directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Abhishek Dandriyal
Abhishek Dandriyal
Frontend Developer , I design and code user-friendly and responsive web applications and projects using,HTML5 , React /Redux MUI . I collaborate with backend developer, UI/UX designers, and project managers to deliver high-quality products that meet the clients' needs and expectations.