Common Commands Used With Apache Subversion

Topics:

This section describes the commands that are used most often with Apache Subversion (SVN).

Update

You can update your local project to the latest version or to a selected version in the SVN repository. A version is a state in the repository that has a sequence number, which increases every time a change is made in the SVN repository with a commit operation.

To update to HEAD, which updates the SVN repository to the latest version available:

Right-click your project, select Team from the context menu, and then Update to HEAD, as shown in the following image.

The SVN repository is updated to the latest available version.

To update to Version, which updates the SVN repository to a specific version:

  1. Right-click your project, select Team from the context menu, and then Update to Version, as shown in the following image.

    The Update dialog opens showing the Update Resources pane, as shown in the following image.

  2. Select the Update to HEAD revision checkbox.
  3. Specify a revision number in the Revision field (manually or by using the Select button).
  4. Click OK.

    The SVN repository is updated to the specified version (revision).

Adding Files to the Repository

To commit a change made to a file and create a version in the SVN repository:

  1. Right-click a file that you want to add, select Team from the context menu, and then Add to Version Control, as shown in the following image.

    A blue icon is appended next to the file name, as shown in the following image.

  2. Right-click the file, select Team from the context menu, and then Commit, as shown in the following image.

    The Commit dialog opens, as shown in the following image.

  3. Enter a descriptive comment and then click OK.

    An orange icon is appended next to the file name, as shown in the following image.

Adding Files to SVN-Ignore

You may want to add only some files to the SVN repository and not others. For example, the files you want to add are required for testing purposes.

To flag files (or folders containing files) so they can be ignored by SVN during a commit operation:

  1. Right-click a file or folder that you want to be ignored by SVN, select Team from the context menu, and then Add to svnignore, as shown in the following image.

    The Add to svnignore dialog opens, as shown in the following image.

  2. Select the Resource(s) by name option and then click OK.

    The file or folder you selected will be ignored by SVN.

Reverting Changes

You may modify files locally and then need to revert these changes to match the current state in the repository.

To revert a change:

  1. Change the perspective by right-clicking, selecting Team from the context menu, and then Synchronize with Repository, as shown in the following image.

    The perspective will change (a Synchronize tab is shown), as shown in the following image.

  2. Right-click the change you want to revert, select Team from the context menu, and then click Revert, as shown in the following image

    The Revert dialog opens and lists the change(s) that will be reverted, as shown in the following image.

  3. Click OK to confirm.

    The confirmed change(s) are removed from the Synchronize perspective.