|
Version Control with Subversion - Basic Work Cycle - Make Changes to Your Working Copy
Make Changes to Your Working Copy
Now you can get to work and make changes in your
working copy. It's usually most convenient to decide on a
particular change (or set of changes) to make, such as writing
a new feature, fixing a bug, etc. The Subversion commands
that you will use here are
svn add
,
svn delete
,
svn copy
,
and
svn move
. However, if you are merely
editing files that are already in Subversion, you may not need
to use any of these commands until you commit. Changes you can
make to your working copy:
-
File changes
-
This is the simplest sort of change. You don't need
to tell Subversion that you intend to change a file;
just make your changes. Subversion will be able to
automatically detect which files have been
changed.
-
Tree changes
-
You can ask Subversion to “mark” files
and directories for scheduled removal, addition,
copying, or moving. While these changes may take place
immediately in your working copy, no additions or
removals will happen in the repository until you commit
them.
To make file changes, use your text editor, word
processor, graphics program, or whatever tool you would
normally use. Subversion handles binary files just as easily
as it handles text files—and just as efficiently
too.
Here is an overview of the four Subversion subcommands
that you'll use most often to make tree changes (we'll cover
svn import
and
svn mkdir
later).
Warning
While you can edit your files with whatever tool you
like, you shouldn't change the structure of your working
copy without letting Subversion know what you're doing. Use
the
svn copy
,
svn
delete
, and
svn move
commands
to change the structure of your working copy, and use the
svn add
command to place new files and
directories under version control.
-
svn add foo
-
Schedule 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 only want to add
foo itself, pass the
--non-recursive (-N )
switch.
-
svn delete foo
-
Schedule 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 removed from your working copy and the repository.
[3]
-
svn copy foo bar
-
Create a new item bar as a
duplicate of foo .
bar is automatically scheduled 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.
-
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.
[an error occurred while processing this directive]
|
|