Andrew Pennebaker
https://github.com/mcandre/cheatsheets/blob/master/svn.md
Subversion is a tried-and-true version control system.
Version Control with Subversion
On some operating systems (Mac OS X), Subversion is built-in. Otherwise, install with:
$ apt-get install subversion
$ brew install subversion
C:\> chocolatey install tortoisesvn
$HOME/.subversion/config
Setup a Subversion server and repo (e.g. with SourceForge, Assembla, Beanstalk, Bountysource, or even GitHub).
$ svn checkout <SVN URL> <local-name>
Example:
$ svn checkout http://checkthread.googlecode.com/svn/ checkthread
$ svn add <files or folders>
$ svn rm [-r] [-f] <files or folders>
$ svn add <files or folders>
$ svn commit
svn commit takes an optional -m <message>
to enter the message directly into the shell.
$ svn revert -R <files or folders>
$ svn merge -c HEAD:r<commit> .
$ svn commit
A safe option is to unmerge a commit, a sort of Subversion Undo operation:
$ svn merge -c -<commit>,-<commit>,-<commit>... .
$ svn commit
$ svn log -l 4
$ svn diff -r <commit a>:<commit b>
$ svn update
$ svn propedit svn:ignore .
This launches a text editor, at which point you edit the ignore patterns. Then you need to commit the changes to the ignore property.
$ svn diff
$ svn commit
project (trunk)$ svn copy http://svn.example.com/repos/calc/trunk http://svn.example.com/repos/calc/branches/myfeature -m 'My Feature'
project (trunk)$ cd ..
project$ svn checkout http://svn.example.com/repos/calc/branches/myfeature
project$ cd myfeature/
project (myfeature)$
$ svn ls ^/branches
myfeature
trunk
In Subversion, branches and tags are not special, they're just folders that happen to be used as branches or tags. Therefore, they can be deleted with:
$ svn delete <branch or tag URL> -m <message>
Then
$ svn up
Or
$ rm -rf <local copy of branch or tag>
You can display the current Subversion branch in your shell prompt by following the Svn Prompt setup instructions:
https://github.com/mcandre/svn-prompt/blob/master/svn-prompt.sh
project (myfeature)$ cd ../trunk/
project (trunk)$ svn merge -r<myfeature creation revision>:HEAD http://svn.example.com/repos/calc/branches/myfeature
project (trunk)$ svn commit
project (trunk)$ svn copy http://svn.example.com/repos/calc/trunk http://svn.example.com/repos/calc/tags/v1.0 -m "Bump to v1.0"
project (trunk)$ cd ../tags/
project$ svn checkout http://svn.example.com/repos/calc/tags/v1.0
project$ cd v1.0
$ svn ls ^/tags
v1.0
$ svn diff -r<start revision>:<end revision> > svn.patch
$ patch -p0 -i <patch file>
$ svn add .
$ svn commit
See https://github.com/mcandre/cheatsheets/blob/master/git.md#convert-a-svn-repo-to-git
- GitHub https://github.com/
- Google Code https://code.google.com/
- Assembla https://www.assembla.com/home
- Beanstalk http://beanstalkapp.com/
- SourceForge http://sourceforge.net/
Subversion can integrate with non-Subversion repositories: