Subversion Cheat Sheet
======================
$svn info prints info pertaining to the current working version
(such as URL, repository root, revision, etc...)
$svn info file prints output info for a file
$svn log Displays the log
$svn log Filename Displays the log for a particular file
[import from local to remote]
$svn import ~/Temp/svnTest https://your.svn_host.com/myProject/Test -m "Initial Import"
$svn import ./ https://your.svn_host.com/myProject/Test -m "Initial Import"
NOTE: Importing does not create a local repository (with .svn directories). It just
copies the info into the remote repository. In order to create a local copy of
the repository, check out a copy with the folloing command:
[checkout from remote to local]
$svn checkout https://your.svn_host.com/myProject/Test/trunk ~/svnTest
$svn checkout https://your.svn_host.com/myProject/Test/trunk
[Update]
$svn update Updates to HEAD revision
$svn update -r 622 Updates to revision 622
$svn update -r PREV Updates to the previous revision
[Commit - within directory to commit]
$svn commit --message "A message"
[Add a file or files to repository. Must commit afterwards to cause changes to occur.]
$svn add File.cpp
$svn add Files.*
$svn add Dir //Will add all files in that directory by default
$svn add Dir --non-recursive //Won't add files, but will add only directory
[Delete a file. Must commit afterwards to cause changes to occur.]
$svn rm File.cpp
[Revert a file back to that in the repository]
$svn revert File.cpp
[Revert all files in this directory and below to previous revision]
$svn revert --recursive .
[See what the status of the files are in a directory]
$svn status
[? means un-versioned file]
[A means scheduled for Addition]
[D means scheduled for Deletion]
[M means Modified in the local copy]
[C means Conflicted]
[! means file is missing (is under version control, but not present)]
For more complete table, see Table 5.1 (pg 67), from book
Subversion Version Control, by Willam Nagel.
[Branch - create a branch. This doesn't automatically "switch" the
current working version to that branch. See switch command below.]
$svn copy --message "Branch from trunk" http://your.svn_host.com/projName/trunk http://your.svn_host.com/projName/branches/yourBranch
[Switch your working copy to another. For example, switch working local to a new branch (after
creating that branch by using svn copy in the above command) so that you're now working in
the branch rather than the trunk.]
$svn switch http://your.svn_host.com/projName/branches/branch1
[Tags - Use svn copy also to create tags. Use 'svn info' if you need to
obtain the current URL.]
$svn copy -m "Completed ver 1.0.0" http://your.svn_host.com/projName/trunk http://your.svn_host.com/projName/tags/Version_1.0.0
[Move or rename a file. Will change repository on next commit, but will affect
local version immediately.]
$svn mv Source Destination
[Shows the difference between the current version of the File and the last time it was changed.]
$svn diff File
|