This documentation was written to describe the 1.7.x series of Apache™ Subversion®. If you are running a different version of Subversion, you are strongly encouraged to visit http://www.svnbook.com/ and instead consult the version of this documentation appropriate for your version of Subversion.
svn update (up) — Update your working copy.
svn update brings changes from the
repository into your working copy. If no revision is
given, it brings your working copy up to date with the
HEAD
revision. Otherwise, it
synchronizes the working copy to the revision given by the
--revision
(-r
) option.
As part of the synchronization, svn
update also removes any stale locks (see
the section called “Sometimes You Just Need to Clean Up”) found in the working
copy.
For each updated item, it prints a line that starts with a character reporting the action taken. These characters have the following meaning:
A
Added
B
Broken lock (third column only)
D
Deleted
U
Updated
C
Conflicted
G
Merged
E
Existed
A character in the first column signifies an update to the actual file, whereas updates to the file's properties are shown in the second column. Lock information is printed in the third column.
As with most subcommands, you can limit the scope of
the update operation to a particular tree depth using the
--depth
option. Alternatively, you can
use the --set-depth
option to set a new
“sticky” working copy depth on the update
target.
Pick up repository changes that have happened since your last update:
$ svn update Updating '.': A newdir/toggle.c A newdir/disclose.c A newdir/launch.c D newdir/README Updated to revision 32.
You can also “update” your working copy to an older revision (Subversion doesn't have the concept of “sticky” files like CVS does; see Appendix B, Subversion for CVS Users):
$ svn update -r30 Updating '.': A newdir/README D newdir/toggle.c D newdir/disclose.c D newdir/launch.c U foo.c Updated to revision 30.
Tip | |
---|---|
If you want to examine an older revision of a single file, you may want to use svn cat instead—it won't change your working copy. |
svn update is also the primary
mechanism used to configure sparse working copies. When
used with the --set-depth
, the update
operation will omit or reenlist individual working copy
members by modifying their recorded ambient depth to the
depth you specify (fetching information from the
repository as necessary). See
the section called “Sparse Directories” for more about
sparse directories.
You can update multiple targets with a single invocation, and Subversion will not only gracefully skip any unversioned targets you provide it, but as of Subversion 1.7 will also include a post-update summary of all the updates it performed:
$ cd my-projects $ svn update * Updating 'calc': U button.c U integer.c Updated to revision 394. Skipped 'tempfile.tmp' Updating 'paint': A palettes.c U brushes.c Updated to revision 60. Updating 'ziptastic': At revision 43. Summary of updates: Updated 'calc' to r394. Updated 'paint' to r60. Updated 'ziptastic' to r43. Summary of conflicts: Skipped paths: 1 $