Apache Subversion (often abbreviated to SVN) helps software developers work together and maintain a complete history of their work.
Version Control System Goals:
- Allow developers to work simultaneously.
- Do not overwrite each other’s changes.
- Maintain history of every change.
Version Control Terminologies
- Repository: A repository is the heart of any version control system. It is the central place where developers store all their work. The repository not only stores files but also the history.
- Trunk: The trunk is a directory where all the main development happens and is usually checked out by developers to work on the project.
- Tags: The tags directory is used to store named snapshots of the project. A tag operation allows developers to give descriptive and memorable names to specific versions in the repository.
- Branches: A branch operation is used to create another line of development. It is useful when you want your development process to split off into two different directions.
- Working copy: Working copy is a snapshot of the repository. The repository is shared by all the teams, but users do not modify it directly. Instead each developer checks out the working copy.
Version Control Command-Line
SVN Command-Line requires permission to run. Make sure you are logged in as 'sudo' or 'su'.
SVN Import – Import command is a quick way to copy an unversioned tree of files into a repository, creating intermediate directories as necessary. SVN import doesn't require a working copy, and your files are immediately committed to the repository.
svn import PATH URL
SVN Checkout – Checkout command is used to download sources from the SVN repository to working copy.
svn checkout/co URL PATH
- ​URL is the URL of the components to checkout.
- If PATH is omitted, the basename of the URL will be used as the destination.
SVN Commit – Commit command saves changes to the repository. Whenever you make changes to the working copy, it will not reflect in the SVN server. To make the changes permanent, you need to apply SVN commit.
svn commit -m "log message"
- Explain why you are changing the file in the -m option.
SVN Add – Add command adds a new file to SVN repository. When you want to add a new file (or directory) to the repository you need to use SVN Add command. The repository will have newly added files when you apply SVN commit.
svn add filename
SVN Delete –Delete command removes an item from the working copy (or repository). File will be deleted from the repository when you apply an SVN Commit.
svn delete URL
SVN Update – Update command brings changes from the repository into your working copy. If no revision is specified, it brings your working copy up-to-date with the HEAD revision.
svn update/up PATH
SVN Diff – Diff command displays the differences between your working copy and the copy in the SVN repository.
svn diff -r 123:120 FILE
- Compare some earlier versions, for example 123 and 120.
SVN Status – Status command can be used to get the status of the file in the working copy.
svn status PATH
SVN Log – Display command can be used to view all the commits made in a file or directory.
svn log PATH
SVN Move – Move command can move a file from one directory to another or rename a file.
svn move src dest
SVN Revert – Revert command undoes your local changes.
svn revert PATH
SVN Externals – Externals command maps a local directory to the URL and possibly a particular revision of a versioned resource. In subversion, you declare externals definitions in groups using the svn:externals property.
svn propset svn:externals myExternalFolderDestination myLocalFolderDestination
Ignoring Items – Users cannot svn:ignore a file. Users must put an svn:ignore property in the directory to ignore that filename pattern.
svn propedit svn:ignore PATH
SVN Client for Windows
TortoiseSVN is an easy-to-use revision, version and source control software for Windows. It is based on Apache™ Subversion (SVN)®; TortoiseSVN and provides an easy-to-use user interface for Subversion. Click here for more information.