Skip to content
Snippets Groups Projects
Commit d7678884 authored by IT Services Group D-PHYS's avatar IT Services Group D-PHYS Committed by Claude Becker
Browse files

how_to_start_with_subversion: external edit

parent 00685868
No related branches found
No related tags found
No related merge requests found
====== How to start with Subversion (Swiki:213) ======
== Differences to CVS ==
While CVS is file based and sees no relationship between files except in which directory they reside, Subversion (SVN) sees a project as a whole thing with one global state and not the states of many single files. So revision numbers are global for a whole project. One revision means a consistent state over all files. Another revision number specific difference is that revision numbers are integers and start with revision 1 at import.
Another effect of Subversion's global view is, that also directories have revisions, that files can be moved around or copied with theirt whole history without fiddling around in the repository itself. Then also file properties (MIME type, svn:ignore for directories, arbitary, project-specific properties, etc.) are versioned in the repository, too.
== Create a repository for your project ==
''svnadmin create /var/lib/subversion/[<group directory>/]<your project repository>''
If you collaborate within a group of people, all participants should have read and write access. Nobody else should have write access.
== Import project ==
''cd ..
svn import -m "Initial import" <your old project directory> <access-scheme>://<server>/[<group directory>/]<your project repository>''
<access-scheme> may be one of http, https, svn, svn+ssh or file or even a self defined access scheme of the form svn+<your personal system to access the repository>
A project may already exist if you are joining a group. You will be told the project name.
== Checkout project ==
''svn checkout <access-scheme>://<server>/[<group directory>/]<your project repository> [<your new project directory>]''
(Shortcut: co instead of checkout)
All steps up to here are necessary to (create and) start working with a Subversion project.
<hr>
From here on, this is what you need for you daily work with the project. Access schemes and repository locations are not needed. The project knows about where its repository is.
== Update Project from Repository ==
''cd <your project directory>
svn update''
(Shortcut: up instead of update)
== Show Local Status and Changed Files ==
''svn status''
(Shortcut: stat or st instead of status)
== Show Locally Changed Files only ==
''svn status --quiet''
(Shortcut: -q instead of --quiet)
Typical use: ''svn st -q''
== Show Updates available in the Repository ==
''svn status --show-updates''
(Shortcut: -u instead of --show-update)
Typical use: ''svn st -u''
== Show Locally Made Changes ==
''svn diff''
Typical use: ''svn diff <filename>''
== Show Changes Between Local Copy and Revision <x> ==
''svn diff -r<x>''
== Show Changes Between Revisions <n> and <n> ==
''svn diff -r<n>-<n>''
== Commit changes to the Repository ==
''cd <your project directory>
svn commit -m "Commit message (e.g. what you changed)"''
(Shortcut: ci instead of commit)
If you changed a file, added or removed one, renamed something, changed properties, create an directory (see all below), etc. you have to commit it to the repository so the change is known there and so others can see it. Otherwise only you can see the changes in your locally checked out copy.
== Revert Changes Locally Made to a File ==
''svn revert <filename>''
== Add new file or directory ==
''svn add <new file or directory>''
If you add a whole directory, all files and subdirectories are added automatically unless they are ignored by Subversion (e.g. Emacs backup files ending with "~") or you give the ''-N'' option:
''svn add -N <new directory>''
== Remove a File or Directory ==
''svn remove <file or directory>''
or
''svn delete <file or directory>''
(Shortcuts: rm or del instead of remove or delete)
Note: the project still keeps informations about a removed file or directory in case you want to check out an old version.
== Create a Directory ==
''svn mkdir <directory>''
In comparision to CVS which cares only about files, Subversion also cares about directories, so if you want to create a new directory in you project, can either create it on the filesystem and then add it (see above) or just let Subversion create and add it at once.
== Copy or Move Files ==
''svn copy <source> <target>
svn move <source> <target>''
(Shortcuts: cp and mv instead of copy and move, rename instead of move also works.)
== More information ==
If you need a quick reference for one Subversion subcommand, e.g. update, use
''svn help update''
The same counts for svnadmin:
''svnadmin help create''
For more read the O'Reilly Subversion book, which is available online at its most current version at [[http://svnbook.red-bean.com/nightly/en/index.html]]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment