![]() |
![]() |
Free Books / Computers / Subversion / | ![]() |
|
![]() |
||||
![]() |
![]() |
|||
![]() |
![]() |
|||
![]() |
||||
|
|
||||
![]() |
![]() |
|||
![]() |
Make Changes to Your Working Copy |
![]() |
||
![]() |
||||
![]() |
![]() |
![]() |
||
![]() |
||||
This section is from the "Version Control with Subversion" book, by Ben Collins-Sussman, Brian W. Fitzpatrick and C. Michael Pilato. Also available from Amazon: Version Control with Subversion.
Now you can get to work and make changes in your working copy. It's usually most convenient to decide on a discrete 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, svn move, and svn mkdir. 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.
There are two kinds of changes you can make 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 handles binary files just as easily as it handles text files—and just as efficiently too. For tree changes, you can ask Subversion to “mark” files and directories for scheduled 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.
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)
option.
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 entirely removed from your working copy and the
repository.
[4]
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.
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.
This command is exactly the same as running
mkdir blort; svn add blort. That is,
a new directory named blort is
created and scheduled for addition.
[4] Of course, nothing is ever totally
deleted from the repository—just from the
HEAD of the repository. You can get
back anything you delete by checking out (or updating
your working copy to) a revision earlier than the one in
which you deleted it. Also see
the section called “Resurrecting Deleted Items”.
subversion, svn, revision control, backup, review, revert, merge, commit, update, branch, changes, collision
![]() |
|
|