名称

svn checkout — 从版本库取出一个工作副本。

概要

svn checkout URL[@REV]... [PATH]

描述

Check out a working copy from a repository. If PATH is omitted, the basename of the URL will be used as the destination. If multiple URLs are given, each will be checked out into a subdirectory of PATH, with the name of the subdirectory being the basename of the URL.

别名

co

改变

创建一个工作副本

访问版本库

选项

--depth ARG
--force
--ignore-externals
--quiet (-q)
--revision (-r) REV

例子

取出一个工作副本到mine目录:

$ svn checkout file:///var/svn/repos/test mine
A  mine/a
A  mine/b
A  mine/c
A  mine/d
Checked out revision 20.
$ ls
mine

检出两个目录到两个单独的工作副本:

$ svn checkout file:///var/svn/repos/test  file:///var/svn/repos/quiz
A  test/a
A  test/b
A  test/c
A  test/d
Checked out revision 20.
A  quiz/l
A  quiz/m
Checked out revision 13.
$ ls
quiz  test

检出两个目录到两个单独的工作副本,但是将两个目录都放到working-copies

$ svn checkout file:///var/svn/repos/test  file:///var/svn/repos/quiz working-copies
A  working-copies/test/a
A  working-copies/test/b
A  working-copies/test/c
A  working-copies/test/d
Checked out revision 20.
A  working-copies/quiz/l
A  working-copies/quiz/m
Checked out revision 13.
$ ls
working-copies

如果你打断一个检出(或其它打断检出的事情,如连接失败。),你可以使用同样的命令重新开始或者是更新不完整的工作副本:

$ svn checkout file:///var/svn/repos/test mine
A  mine/a
A  mine/b
^C
svn: The operation was interrupted
svn: caught SIGINT

$ svn checkout file:///var/svn/repos/test mine
A  mine/c
^C
svn: The operation was interrupted
svn: caught SIGINT

$ svn update mine
A  mine/d
Updated to revision 20.

If you wish to check out some revision other than the most recent one, you can do so by providing the --revision (-r) option to the svn checkout command:

$ svn checkout -r 2 file:///var/svn/repos/test mine
A  mine/a
Checked out revision 2.