← 返回命令列表

Linux command

co 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Check out the latest revision

co [file.txt]

Check out a file for editing

co -l [file.txt]

Check out a specific revision

co -r[1.2] [file.txt]

Check out and unlock

co -u [file.txt]

Check out a revision by date

co -d"[2024-01-15]" [file.txt]

Check out quietly

co -q [file.txt]

Force checkout

co -f [file.txt]

说明

co is the checkout command for RCS (Revision Control System), a legacy version control system for managing file revisions. It retrieves revisions from RCS files and places them in the working directory for viewing or editing. By default, co retrieves the latest revision in read-only mode. The -l flag locks the revision for exclusive editing, preventing others from checking out the same revision for modification. After editing, the file is checked back in with ci. RCS stores revision history in special files (typically ending in ,v) and co reconstructs working files from this delta-based storage. While largely superseded by distributed version control systems, RCS remains useful for simple single-file versioning.

参数

-l
Lock the checked-out revision to prevent others from editing.
-u
Unlock the revision; check out without locking.
-r_REV_
Check out specific revision REV.
-d_DATE_
Check out the latest revision at or before DATE.
-f
Force overwrite of the working file if it exists.
-q
Quiet mode; suppress diagnostic output.
-p
Print the revision to stdout instead of creating a working file.
-j_JOINLIST_
Generate new revision by merging differences between revisions.
-k_SUBST_
Set keyword substitution mode (kv, kvl, k, o, b, v).
-s_STATE_
Check out the latest revision with the given state.
-w_LOGIN_
Check out the latest revision checked in by LOGIN.
-T
Set the working file's modification time to the revision's check-in time.
-V
Print RCS version number.

FAQ

What is the co command used for?

co is the checkout command for RCS (Revision Control System), a legacy version control system for managing file revisions. It retrieves revisions from RCS files and places them in the working directory for viewing or editing. By default, co retrieves the latest revision in read-only mode. The -l flag locks the revision for exclusive editing, preventing others from checking out the same revision for modification. After editing, the file is checked back in with ci. RCS stores revision history in special files (typically ending in ,v) and co reconstructs working files from this delta-based storage. While largely superseded by distributed version control systems, RCS remains useful for simple single-file versioning.

How do I run a basic co example?

Run `co [file.txt]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -l do in co?

Lock the checked-out revision to prevent others from editing.