Linux‎ > ‎

Subversion

Subversion (svn)

create a repository:

svnadmin create --fs-type fsfs $HOME/trunk

create a working copy:

svn checkout file://$HOME/trunk $HOME/checkout

create a working copy remotely in current folder via ssh

svn checkout svn+ssh://svn@hal.compute.info/home/svn/trunk .

go in the working directory and see the status

svn stat

add files to the repository (you have to commit after adding):

svn add <file or folder name>

commit changes

svn commit -m 'my first file!'

bring the working folder up to date

svn update

look at svn log

svn log

look at revision 1 log in verbose

svn -v -r 1

diff two revisions

svn diff -r 2:3

rename a file (no manual mv command is needed. working copy gets updated too)

svn mv file1 file2

undo something done with 'svc *' but not commited yet:

svn revert -R .

Undoing what was done in revision 3 to 4

svn merge -r 4:3



Recover a deleted file:
First find out the version you are looking for
svn log --verbose

Then recover the file you are looking for, for example file.txt

svn up -r 250 file.txt


Forcefully add all new files in the working folder:

$ svn add --force *


Forcefully delete all files that have been deleted off of the working folder from the repository:

svn st | grep '^!' | awk '{print $2}' | xargs svn delete --force



Comments