12.2.3 Subversion usage examples
The following sections teach you how to use different commands in Subversion.
12.2.3.1 Create a new Subversion archive
To create a new Subversion archive, type the following:
$ cd ~/your-project # go to your source directory
$ svn import https://localhost/repos your-project \
project-name -m "initial project import"
This creates a directory named project-name in your Subversion
repository which contains your project files. Look at https://localhost/repos/
to see if it's there.
12.2.3.2 Working with Subversion
Working with project-y using Subversion:
$ cd # move to the work area
$ svn co https://localhost/repos/project-y # Check out sources
$ cd project-y
... do some work ...
$ svn diff # similar to diff -u repository/ local/
$ svn revert modified_file # undo changes to a file
$ svn ci -m "Describe changes" # check in your changes to the repository
$ vi newfile_added
$ svn add newfile_added
$ svn add new_dir # recursively add all files in new_dir
$ svn add -N new_dir2 # nonrecursively add the directory
$ svn ci -m "Added newfile_added, new_dir, new_dir2"
$ svn up # merge in latest version from repository
$ svn log # shows all changes committed
$ svn copy https://localhost/repos/project-y \
https://localhost/repos/project-y-branch \
-m "creating my branch of project-y" # branching project-y
$ svn copy https://localhost/repos/project-y \
https://localhost/repos/proj-y_release1.0 \
-m "project-y 1.0 release" # added release tag
... note that branching and tagging are the same. The only difference
... is that branches get committed whereas tags do not.
... make changes to branch ...
$ # merge branched copy back to main copy
$ svn merge https://localhost/repos/project-y \
https://localhost/repos/project-y-branch
$ svn co -r 4 https://localhost/repos/project-y # get revision 4