FreeKB - How to check out a file in CVS
How to check out a file in CVS

Home > Search > How-to


If you are not familiar with CVS, check out our getting started article. These examples are based on Linux.

Checking out pulls a file from your master CVS repository into your local CVS repository (branch). For example, let's say the root directory of your master CVS repository is /var/cvs and the root directory of your local CVS respository (branch) is /home/john.doe/cvs. Let's also say that you want to pull /var/cvs/foo.txt into your local CVS repository. To do this, you must first be in your branch.

cd /home/john.doe

 

You can then use the cvs checkout command to pull foo.txt from the master CVS repository into your local CVS repository.

cvs checkout cvs/foo.txt

 

The prior command will produce lines beginning with C (checkout) or U (update), like this.

C /var/cvs/foo.txt
U /var/cvs/foo.txt

 

If you are pulling foo.txt into your local CVS repository for the first time, the line should begin with C (checkout). If foo.txt already resides in your local CVS repository, the line should begin with U (update).

Unfortunately, the cvs checkout command produces no output, so the checkout command does not confirm that you were able to pull down the latest revision of the file from the master CVS repository. However, the cvs status command can be used to see if you have the latest revision of the file. In this example, the status is "Up-to-date" and the working revision (local version of file) is the same as the repository revision (master version of file).

cvs status cvs/foo.txt
=====================================================================
File: foo.txt  Status: Up-to-date

    Working revision      1.0  Mon Jan 01 12:34:56 2017
    Repository revisions: 1.0  /var/cvs/foo.txt
    Sticky Tag:          (none)
    Sticky Date:         (none)
    Sticky Options:      (none)

 

 


Quiet

The -q (quiet) and -Q (very quiet) options can be used to suppress output, which is usually preferred when doing a checkout in a script.

cvs -q checkout /var/cvs/foo.txt
cvs -Q checkout /var/cvs/foo.txt

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter b3835 in the box below so that we can be sure you are a human.




Comments