Subversion Commands

Common Commands

Version information

$ svn info

See changed files
$ svn stat

See updated files
$ svn stat -u

Commit changes
$ svn commit –m “message” /path/to/file1 /path/to/file2 /path/to/file3…

Undo changes
$ svn revert /path/to/file

Check out latest version
$ svn co svn://localhost/trunk/ /path/to/folder/

Check out old version
$ svn co -r 123 svn://localhost/trunk/ /path/to/folder/

Add file (need to commit after)
$ svn add /path/to/new/file

Delete file (need to commit after)
$ svn remove /path/to/file

Copy file (copy history from the file to the new one – need to commit after)
$ svn copy /path/to/file /path/to/newfile

Move file (retains history from the old file to the new one – need to commit after)
$ svn move /path/to/oldfile /path/to/newfile

See file changes
$ svn diff --diff-cmd /usr/bin/diff -x "-bB" /path/to/file

Other Commands

Ignore directories / files when they are recreated or keep changing (you may need to do an ‘svn update’ after this before you can commit)

$ svn propset svn:ignore "file.extension" directory

Merge changes into a directory
$ svn merge –r 123:234 svn://localhost/trunk/ /path/to/folder/

Compare branch against a directory – useful before merging ( dry run shows the results that would happen if you did a merge )
$ svn merge -r 123:456 svn://localhost/branches/branch /path/to/folder/ --dry-run

Switch to a different version
$ svn switch -r 123 svn://localhost/trunk/ /path/to/folder/

Edit a commit comment
$ svn propedit svn:log --revprop -r 123 svn://localhost/trunk --editor-cmd vi

See subversion history
$ svn log svn://localhost/trunk --stop-on-copy --verbose

Create a new repository
$ svnadmin create /home/svn_repository
$ cd /home
$ mkdir svn_repository

Import files into a repository
$ svn import /path/to/project svn://localhost/trunk -m "message"

Create a new branch
$ svn copy –r 123 svn://localhost/trunk svn://localhost/branches/name -m "message"



One Response to “Subversion Commands”  

  1. 1 House of Code


Leave a Reply