4.6. Make Changes to Your Working Copy
Now you can get to work and make changes in your working copy. You can make two kinds of changes to your working copy: file changes and tree changes.
You don't need to tell Subversion that you intend to change a file; just make your changes using your text editor, word processor, graphics program, or whatever tool you would normally use. Subversion automatically detects which files have been changed, and in addition, it handles binary files just as easily as it handles text files—and just as efficiently, too.
Tree changes are different, and involve changes to a directory's structure. Such changes include adding and removing files, renaming files or directories, and copying files or directories to new locations. For tree changes, you use Subversion operations to “schedule” files and directories for removal, addition, copying, or moving. These changes may take place immediately in your working copy, but no additions or removals will happen in the repository until you commit them.
Here is an overview of the five Subversion subcommands that you'll use most often to make tree changes:
svn add FOO
Use this to schedule the file, directory, or symbolic link FOO to be added to the repository.
When you next commit, FOO will become a child of its parent directory. Note that if FOO is a directory, everything underneath FOO will be scheduled for addition. If you want only to add FOO itself, pass the --depth=empty
option.
svn delete FOO
Use this to schedule the file, directory, or symbolic link FOO to be deleted from the repository. If FOO is a file or link, it is immediately deleted from your working copy. If FOO is a directory, it is not deleted, but Subversion schedules it for deletion. When you commit your changes, FOO will be entirely removed from your working copy and the repository.
svn copy FOO BAR
Create a new item BAR as a duplicate of FOO and automatically schedule BAR for addition. When BAR is added to the repository on the next commit, its copy history is recorded (as having originally come from FOO).
svn copy
does not create intermediate directories unless you pass the --parents
option.
svn move FOO BAR
This command is exactly the same as running svn copy FOO BAR; svn delete FOO
.
That is, BAR is scheduled for addition as a copy of FOO,
and FOO is scheduled for removal.
svn move
does not create intermediate directories unless you pass the --parents
option.
svn mkdir FOO
This command is exactly the same as running mkdir FOO; svn add FOO
.
That is, a new directory named FOO is created and scheduled for addition.
4.6.1. Exercise - Create a Biography File and Add It to the Local Repository
Using other biography files as examples, create a biography file of yourself in the sandbox/bios/
directory and add it to your local repository.