名称

svn commit (ci) — 将修改从工作副本发送到版本库。

概要

svn commit [PATH...]

描述

Send changes from your working copy to the repository. If you do not supply a log message with your commit by using either the --file (-F) or --message (-m) option, svn will launch your editor for you to compose a commit message. See the editor-cmd list entry in 第 1.3.2 节 “配置”.

svn commit will send any lock tokens that it finds and will release locks on all PATHs committed (recursively) unless --no-unlock is passed.

[提示] 提示

If you begin a commit and Subversion launches your editor to compose the commit message, you can still abort without committing your changes. If you want to cancel your commit, just quit your editor without saving your commit message and Subversion will prompt you to either abort the commit, continue with no message, or edit the message again.

选项

--changelist ARG
--depth ARG
--editor-cmd CMD
--encoding ENC
--file (-F) FILENAME
--force-log
--keep-changelists
--message (-m) MESSAGE
--no-unlock
--quiet (-q)
--targets FILENAME
--with-revprop ARG

例子

使用命令行提交一个包含日志信息的文件修改,当前目录(.)是没有说明的目标路径:

$ svn commit -m "added howto section."
Sending        a
Transmitting file data .
Committed revision 3.

Commit a modification to the file foo.c (explicitly specified on the command line) with the commit message in a file named msg:

$ svn commit -F msg foo.c
Sending        foo.c
Transmitting file data .
Committed revision 5.

If you want to use a file that's under version control for your commit message with --file (-F), you need to pass the --force-log option:

$ svn commit -F file_under_vc.txt foo.c
svn: The log message file is under version control
svn: Log message file is a versioned file; use '--force-log' to override

$ svn commit --force-log -F file_under_vc.txt foo.c
Sending        foo.c
Transmitting file data .
Committed revision 6.

提交一个已经预定要删除的文件:

$ svn commit -m "removed file 'c'."
Deleting       c

Committed revision 7.