# CO - check out RCS revisions - man - [phpMan]

> **TLDR:** Check out RCS revisions (retrieve working files from the Revision Control System).
>
- Check out the latest revision of a file (retrieves a read-only copy):
  `co {{path/to/file}}`
- Check out a file with a lock for editing:
  `co -l {{path/to/file}}`
- Check out a specific revision of a file:
  `co -r{{revision}} {{path/to/file}}`
- Check out a file and overwrite it if it already exists:
  `co -f -l {{path/to/file}}`
- Print a specific revision to `stdout` without creating a file:
  `co -p -r{{revision}} {{path/to/file}}`

*Source: tldr-pages*

---

[_CO_(1)](https://www.chedong.com/phpMan.php/man/CO/1/markdown)                                  General Commands Manual                                 [_CO_(1)](https://www.chedong.com/phpMan.php/man/CO/1/markdown)

## NAME
       co - check out RCS revisions

## SYNOPSIS
       **co **[_options_] _file_ ...

## DESCRIPTION
       **co **retrieves a revision from each RCS file and stores it into the corresponding working file.

       Filenames  matching  an  RCS suffix denote RCS files; all others denote working files.  Names
       are paired as explained in [**ci**(1)](https://www.chedong.com/phpMan.php/man/ci/1/markdown).

       Revisions of an RCS file can be checked out locked or unlocked.  Locking a revision  prevents
       overlapping updates.  A revision checked out for reading or processing (e.g., compiling) need
       not be locked.  A revision checked out for editing and later checkin must normally be locked.
       Checkout  with locking fails if the revision to be checked out is currently locked by another
       user.  (A lock can be broken with [**rcs**(1)](https://www.chedong.com/phpMan.php/man/rcs/1/markdown).)  Checkout with locking also requires the caller to
       be on the access list of the RCS file, unless he is the owner of the file or  the  superuser,
       or  the access list is empty.  Checkout without locking is not subject to accesslist restric‐
       tions, and is not affected by the presence of locks.

       A revision is selected by options for revision or branch number, checkin  date/time,  author,
       or state.  When the selection options are applied in combination, **co **retrieves the latest re‐
       vision  that  satisfies  all  of them.  If none of the selection options is specified, **co **re‐
       trieves the latest revision on the default branch (normally the trunk, see the **-b  **option  of
       [**rcs**(1)](https://www.chedong.com/phpMan.php/man/rcs/1/markdown)).   A  revision or branch number can be attached to any of the options **-f**, **-I**, **-l**, **-M**,
### -p -q -r -u -d  -s  -w 
       branch, the _selected_ branch, which is either specified by one of **-f**, ..., **-u**, or the  default
       branch.

       A **co **command applied to an RCS file with no revisions creates a zero-length working file.  **co**
       always performs keyword substitution (see below).

## OPTIONS
### -r
              retrieves the latest revision whose number is less than or equal to _rev_.  If _rev_ indi‐
              cates  a  branch  rather  than  a  revision, the latest revision on that branch is re‐
              trieved.  If _rev_ is omitted, the latest revision on the default branch (see the **-b **op‐
              tion of [**rcs**(1)](https://www.chedong.com/phpMan.php/man/rcs/1/markdown)) is retrieved.  If _rev_ is **$**, **co **determines  the  revision  number  from
              keyword  values in the working file.  Otherwise, a revision is composed of one or more
              numeric or symbolic fields separated by periods.  If _rev_ begins with  a  period,  then
              the default branch (normally the trunk) is prepended to it.  If _rev_ is a branch number
              followed  by  a  period, then the latest revision on that branch is used.  The numeric
              equivalent of a symbolic field is specified with the **-n **option of the  commands  [**ci**(1)](https://www.chedong.com/phpMan.php/man/ci/1/markdown)
              and [**rcs**(1)](https://www.chedong.com/phpMan.php/man/rcs/1/markdown).

### -l
              same as **-r**, except that it also locks the retrieved revision for the caller.

### -u
              same  as  **-r**,  except  that  it unlocks the retrieved revision if it was locked by the
              caller.  If _rev_ is omitted, **-u **retrieves the revision locked by the caller,  if  there
              is one; otherwise, it retrieves the latest revision on the default branch.

### -f
              forces  the  overwriting  of the working file; useful in connection with **-q**.  See also
              FILE MODES below.

### -kkv   
              **vision  **keyword.   A  locker's  name  is  inserted in the value of the **Header**, **Id**, and
              **Locker **keyword strings only as a file is being locked, i.e. by **ci -l **and **co -l**.   This
              is the default.

### -kkvl   -kkv
              currently locked.

### -kk    
              STITUTION  below.   For  example, for the **Revision **keyword, generate the string **$Revi‐**
              **sion$ **instead of **$Revision: 5.10.1 $**.  This option is useful to ignore differences due
              to keyword substitution when comparing different revisions of a  file.   Log  messages
              are  inserted  after  **$Log$  **keywords even if **-kk **is specified, since this tends to be
              more useful when merging changes.

### -ko    
              checked in.  For example, for the **Revision **keyword, generate the string **$Revision: 1.1**
              **$  **instead of **$Revision: 5.10.1 $ **if that is how the string appeared when the file was
              checked in.  This can be useful for file formats that cannot tolerate any  changes  to
              substrings that happen to take the form of keyword strings.

### -kb     -ko
              forms  all working file input and output in binary mode.  This makes little difference
              on Posix and Unix hosts, but on DOS-like hosts one should use **rcs -i -kb **to initialize
              an RCS file intended to be used for binary files.  Also,  on  all  hosts,  [**rcsmerge**(1)](https://www.chedong.com/phpMan.php/man/rcsmerge/1/markdown)
              normally refuses to merge files when **-kb **is in effect.

### -kv    
              word, generate the string **5.10.1 **instead of **$Revision: 5.10.1 $**.  This can help gener‐
              ate files in programming languages where it is hard to strip keyword  delimiters  like
              **$Revision: $ **from a string.  However, further keyword substitution cannot be performed
              once  the keyword names are removed, so this option should be used with care.  Because
              of this danger of losing keywords, this option cannot be combined  with  **-l**,  and  the
              owner  write  permission  of  the  working file is turned off; to edit the file later,
              check it out again without **-kv**.

### -p
              prints the retrieved revision on the standard output rather than  storing  it  in  the
              working file.  This option is useful when **co **is part of a pipe.

### -q
              quiet mode; diagnostics are not printed.

### -I
              interactive  mode;  the  user is prompted and questioned even if the standard input is
              not a terminal.

### -d_
              than  or equal to _date_.  The date and time can be given in free format.  The time zone
              **LT **stands for local time; other common time zone names are understood.   For  example,
              the  following  _date_s  are  equivalent  if local time is January 11, 1990, 8pm Pacific
              Standard Time, eight hours west of Coordinated Universal Time (UTC):

                     **8:00 pm lt**
                     **4:00 AM, Jan. 12, 1990           **default is UTC
                     **1990-01-12 04:00:00+00           **ISO 8601 (UTC)
                     **1990-01-11 20:00:00-08           **ISO 8601 (local time)
                     **1990/01/12 04:00:00              **traditional RCS format
                     **Thu Jan 11 20:00:00 1990 LT      **output of [**ctime**(3)](https://www.chedong.com/phpMan.php/man/ctime/3/markdown) + **LT**
                     **Thu Jan 11 20:00:00 PST 1990     **output of [**date**(1)](https://www.chedong.com/phpMan.php/man/date/1/markdown)
                     **Fri Jan 12 04:00:00 GMT 1990**
                     **Thu, 11 Jan 1990 20:00:00 -0800  **Internet RFC 822
                     **12-January-1990, 04:00 WET**

              Most fields in the date and time can be defaulted.  The default time zone is  normally
              UTC,  but  this can be overridden by the **-z **option.  The other defaults are determined
              in the order year, month, day, hour, minute, and second (most to  least  significant).
              At  least one of these fields must be provided.  For omitted fields that are of higher
              significance than the highest provided field, the time zone's current values  are  as‐
              sumed.  For all other omitted fields, the lowest possible values are assumed.  For ex‐
              ample,  without **-z**, the date **20, 10:30 **defaults to 10:30:00 UTC of the 20th of the UTC
              time zone's current month and year.  The date/time  must  be  quoted  if  it  contains
              spaces.

### -M
              Set  the modification time on the new working file to be the date of the retrieved re‐
              vision.  Use this option with care; it can confuse [**make**(1)](https://www.chedong.com/phpMan.php/man/make/1/markdown).

### -s_
              retrieves the latest revision on the selected branch whose state is set to _state_.

### -S     
              exists.  Effectively, this means the user cannot check out the same revision twice.

### -T     
              lock  is added or removed.  This option can suppress extensive recompilation caused by
              a [**make**(1)](https://www.chedong.com/phpMan.php/man/make/1/markdown) dependency of some other copy of the working file on the RCS file.  Use this
              option with care; it can suppress recompilation even when it is needed, i.e. when  the
              change of lock would mean a change to keyword strings in the other working file.

### -w
              retrieves  the latest revision on the selected branch which was checked in by the user
              with login name _login_.  If the argument _login_ is omitted, the caller's  login  is  as‐
              sumed.

### -j_
              generates  a new revision which is the join of the revisions on _joinlist_.  This option
              is largely obsoleted by [**rcsmerge**(1)](https://www.chedong.com/phpMan.php/man/rcsmerge/1/markdown) but is retained for backwards compatibility.

              The _joinlist_ is a comma-separated list of pairs of the form _rev2_**:_**rev3,_ where _rev2_  and
              _rev3_  are (symbolic or numeric) revision numbers.  For the initial such pair, _rev1_ de‐
              notes the revision selected by the above options **-f**, ..., **-w**.  For  all  other  pairs,
              _rev1_  denotes  the  revision generated by the previous pair.  (Thus, the output of one
              join becomes the input to the next.)

              For each pair, **co **joins revisions _rev1_ and _rev3_ with respect to _rev2_.  This means that
              all changes that transform _rev2_ into _rev1_ are applied to a copy of _rev3_.  This is par‐
              ticularly useful if _rev1_ and _rev3_ are the ends of two branches that  have  _rev2_  as  a
              common  ancestor.  If _rev1_<_rev2_<_rev3_ on the same branch, joining generates a new revi‐
              sion which is like _rev3,_ but with all changes that lead from _rev1_ to _rev2_ undone.   If
              changes  from _rev2_ to _rev1_ overlap with changes from _rev2_ to _rev3,_ **co **reports overlaps
              as described in [**merge**(1)](https://www.chedong.com/phpMan.php/man/merge/1/markdown).

              For the initial pair, _rev2_ can be omitted.  The default is the  common  ancestor.   If
              any of the arguments indicate branches, the latest revisions on those branches are as‐
              sumed.  The options **-l **and **-u **lock or unlock _rev1_.

### -V     

### -V_
              ing RCS files with others who are running older versions of RCS.  To see which version
              of RCS your correspondents are running, have them invoke **rcs -V**; this works with newer
              versions of RCS.  If it doesn't work, have them invoke **rlog **on an RCS file; if none of
              the  first  few  lines  of  output  contain the string **branch: **it is version 3; if the
              dates' years have just two digits, it is version 4; otherwise, it is  version  5.   An
              RCS  file  generated while emulating version 3 loses its default branch.  An RCS revi‐
              sion generated while emulating version 4 or earlier has a time stamp that is off by up
              to 13 hours.  A revision extracted while emulating version 4 or earlier  contains  ab‐
              breviated  dates  of  the form _yy_**/_**mm_**/_**dd_ and can also contain different white space and
              line prefixes in the substitution for **$Log$**.

### -x_
              Use _suffixes_ to characterize RCS files.  See [**ci**(1)](https://www.chedong.com/phpMan.php/man/ci/1/markdown) for details.

### -z_
              time zone for _date_ in the **-d_**date_ option.  The _zone_ should be empty, a numeric UTC off‐
              set,  or  the  special  string **LT **for local time.  The default is an empty _zone_, which
              uses the traditional RCS format of UTC without  any  time  zone  indication  and  with
              slashes separating the parts of the date; otherwise, times are output in ISO 8601 for‐
              mat  with  time  zone indication.  For example, if local time is January 11, 1990, 8pm
              Pacific Standard Time, eight hours west of UTC, then the time is output as follows:

                     _option_    _time_ _output_
### -z        1990/01/12 04:00:00        _(default)
                     **-zLT      1990-01-11 20:00:00-08**
                     **-z+05:30  1990-01-12 09:30:00+05:30**

              The **-z **option does not affect dates stored in RCS files, which are always UTC.

## KEYWORD SUBSTITUTION
       Strings of the form **$_**keyword_**$ **and **$_**keyword_**:_**..._**$  **embedded  in  the  text  are  replaced  with
       strings of the form **$_**keyword_**:_**value_**$ **where _keyword_ and _value_ are pairs listed below.  Keywords
       can be embedded in literal strings or comments to identify a revision.

       Initially,  the  user  enters  strings of the form **$_**keyword_**$_**._  On checkout, **co **replaces these
       strings with strings of the form **$_**keyword_**:_**value_**$_**._  If a revision containing  strings  of  the
       latter  form  is checked back in, the value fields will be replaced during the next checkout.
       Thus, the keyword values are automatically updated on checkout.  This automatic  substitution
       can be modified by the **-k **options.

       Keywords and their corresponding values:

### $Author$
              The login name of the user who checked in the revision.

       **$Date$ **The date and time the revision was checked in.  With **-z_**zone_ a numeric time zone offset
              is appended; otherwise, the date is UTC.

### $Header$
              A standard header containing the full RCS file name, the revision number, the date and
              time,  the  author, the state, and the locker (if locked).  With **-z_**zone_ a numeric time
              zone offset is appended to the date; otherwise, the date is UTC.

       **$Id$   **Same as **$Header$**, except that the RCS file name is without the directory components.

### $Locker$
              The login name of the user who locked the revision (empty if not locked).

       **$Log$  **The log message supplied during checkin, preceded by a header containing the RCS  file
              name,  the  revision number, the author, and the date and time.  With **-z_**zone_ a numeric
              time zone offset is appended; otherwise, the date is UTC.  Existing log  messages  are
              _not_ replaced.  Instead, the new log message is inserted after **$Log:**...**$**.  This is use‐
              ful for accumulating a complete change log in a source file.

              Each  inserted line is prefixed by the string that prefixes the **$Log$ **line.  For exam‐
              ple, if the **$Log$ **line is “**// $Log: tan.cc $**”, RCS prefixes each line of the log  with
              “**// **”.   This  is  useful  for languages with comments that go to the end of the line.
              The convention for other languages is to use a “ **∗ **” prefix inside  a  multiline  com‐
              ment.   For  example,  the initial log comment of a C program conventionally is of the
              following form:

                     **/∗**
                      **∗ $Log$**
                      **∗/**

              For backwards compatibility with older versions of RCS, if the log prefix is **/∗ **or  **(∗**
              surrounded by optional white space, inserted log lines contain a space instead of **/ **or
              **(**; however, this usage is obsolescent and should not be relied on.

       **$Name$ **The  symbolic name used to check out the revision, if any.  For example, **co -rJoe **gen‐
              erates **$Name: Joe $**.  Plain **co **generates just **$Name:  $**.

### $RCSfile$
              The RCS file name without directory components.

### $Revision$
              The revision number assigned to the revision.

### $Source$
              The full RCS file name.

### $State$
              The state assigned to the revision with the **-s **option of [**rcs**(1)](https://www.chedong.com/phpMan.php/man/rcs/1/markdown) or [**ci**(1)](https://www.chedong.com/phpMan.php/man/ci/1/markdown).

       The following characters in keyword values are represented by escape sequences to  keep  key‐
       word strings well-formed.

              _char_     _escape_ _sequence_
              tab      **\t**
              newline  **\n**
              space    **\040**
              **$        \044**
              **\        \\**

## FILE MODES
       The  working  file inherits the read and execute permissions from the RCS file.  In addition,
       the owner write permission is turned on, unless **-kv **is set or the file  is  checked  out  un‐
       locked and locking is set to strict (see [**rcs**(1)](https://www.chedong.com/phpMan.php/man/rcs/1/markdown)).

       If  a  file  with  the  name  of the working file exists already and has write permission, **co**
       aborts the checkout, asking beforehand if possible.  If the  existing  working  file  is  not
       writable or **-f **is given, the working file is deleted without asking.

## FILES
       **co  **accesses  files much as [**ci**(1)](https://www.chedong.com/phpMan.php/man/ci/1/markdown) does, except that it does not need to read the working file
       unless a revision number of **$ **is specified.

## ENVIRONMENT
       **RCSINIT**
              Options prepended to the argument list, separated  by  spaces.   A  backslash  escapes
              spaces  within  an option.  The **RCSINIT **options are prepended to the argument lists of
              most RCS commands.  Useful **RCSINIT **options include **-q**, **-V**, **-x**, and **-z**.

       **RCS_MEM_LIMIT**
              Normally, for speed, commands either memory map or copy into memory the  RCS  file  if
              its size is less than the _memory-limit_, currently defaulting to ``unlimited''.  Other‐
              wise  (or  if  the  initially-tried speedy ways fail), the commands fall back to using
              standard i/o routines.  You can adjust the memory limit by setting **RCS_MEM_LIMIT **to  a
              numeric  value _lim_ (measured in kilobytes).  An empty value is silently ignored.  As a
              side effect, specifying **RCS_MEM_LIMIT **inhibits fall-back to slower routines.

       **TMPDIR **Name of the temporary directory.  If not set, the environment variables **TMP  **and  **TEMP**
              are  inspected  instead and the first value found is taken; if none of them are set, a
              host-dependent default is used, typically **/tmp**.

## DIAGNOSTICS
       The RCS file name, the working file name, and the revision number retrieved  are  written  to
       the  diagnostic  output.  The exit status is zero if and only if all operations were success‐
       ful.

## IDENTIFICATION
       Author: Walter F. Tichy.
       Manual Page Revision: 5.10.1; Release Date: 2022-02-19.
       Copyright © 2010-2022 Thien-Thi Nguyen.
       Copyright © 1990, 1991, 1992, 1993, 1994, 1995 Paul Eggert.
       Copyright © 1982, 1988, 1989 Walter F. Tichy.

## SEE ALSO
       [**ci**(1)](https://www.chedong.com/phpMan.php/man/ci/1/markdown), [**ctime**(3)](https://www.chedong.com/phpMan.php/man/ctime/3/markdown), [**date**(1)](https://www.chedong.com/phpMan.php/man/date/1/markdown), [**ident**(1)](https://www.chedong.com/phpMan.php/man/ident/1/markdown), [**make**(1)](https://www.chedong.com/phpMan.php/man/make/1/markdown), [**rcs**(1)](https://www.chedong.com/phpMan.php/man/rcs/1/markdown),  [**rcsclean**(1)](https://www.chedong.com/phpMan.php/man/rcsclean/1/markdown),  [**rcsdiff**(1)](https://www.chedong.com/phpMan.php/man/rcsdiff/1/markdown),  [**rcsmerge**(1)](https://www.chedong.com/phpMan.php/man/rcsmerge/1/markdown),
       [**rlog**(1)](https://www.chedong.com/phpMan.php/man/rlog/1/markdown), [**rcsfile**(5)](https://www.chedong.com/phpMan.php/man/rcsfile/5/markdown).

       Walter  F.  Tichy,  RCS--A  System for Version Control, _Software--Practice_ _&_ _Experience_ **15**, 7
       (July 1985), 637-654.

       The full documentation for RCS is maintained as a Texinfo manual.  If  the  [**info**(1)](https://www.chedong.com/phpMan.php/man/info/1/markdown)  and  RCS
       programs are properly installed at your site, the command

              **info rcs**

       should give you access to the complete manual.  Additionally, the RCS homepage:

              **<http://www.gnu.org/software/rcs/>**

       has news and links to the latest release, development site, etc.

## LIMITS
       Links to the RCS and working files are not preserved.

       There  is  no  way  to selectively suppress the expansion of keywords, except by writing them
       differently.  In nroff and troff, this is done by embedding the null-character  **\&  **into  the
       keyword.

GNU RCS 5.10.1                               2022-02-19                                        [_CO_(1)](https://www.chedong.com/phpMan.php/man/CO/1/markdown)
