The working copy (WC) is your local and private workspace that you use to interact with the central Subversion repository. You use the working copy to modify the contents of your project and fetch changes committed by others.
The working copy contains your project's data and looks and acts like a regular directory on your local file system, but with one major difference -- the working copy tracks the status and changes of files
and directories within. You can think of the working copy as of a regular directory with a version-control flavor added by a hidden .svn
metadata directory at its root.
Most of the time, you are going to perform modifications to the project's data by modifying the contents of the working copy. As soon as you are satisfied with the modifications and you've reviewed them thoroughly, you are ready to publish them to the central repository.
You can perform any actions with your project's data within the working copy, but operations that involve copying, moving, renaming and deleting must be performed using the corresponding svn
commands:
Modifying existing files. Modify the files as you usually do using your favorite text processor, graphics editor, audio editing software, IDE, etc. As soon as you save the changes to disk, Subversion will recognize them automatically.
Adding new files. Put new files to the working copy and Subversion will recognize them as unversioned. It will not automatically start tracking the new files unless you run svn add
command:
svn add foo.cs
Moving files and directories. Move files and directories using svn move
command:
svn move foo.cs bar.cs
Renaming files and directories. Rename files and directories using svn rename
command:
svn rename foo.cs bar.cs
NOTE: svn rename
command is an alias of svn move
command.
Copying files and directories. Copy files and directories using svn copy
command:
svn copy foo.cs bar.cs
Deleting files and directories. Delete files and directories using svn delete
command:
svn delete foo.cs
Checking the status of files and directories in the working copy. Review your changes using svn status
(or svn st
for short) command:
svn status
IMPORTANT: Always review your changes before committing them. This will help you to avoid committing unnecessary or irrelevant changes.
Reverting changes. Revert your changes using svn revert
command:
svn revert foo.c
Reverting all changes: From the repository's root:
svn revert -R .
IMPORTANT: Reverted uncommitted changes will be lost forever. You won't be able to recover the reverted changes. Use
svn revert
with caution! If you want to keep the changes but need to revert, save them in a patch. See example of how to create and apply a patch.