FreeKB - CVS (Version Control) cvs update command
CVS (Version Control) - cvs update command

If you are not familiar with CVS, check out our getting started article.

These examples are based on Linux. Let's say your CVS home directory is /var/cvs. Move into your CVS home directory.

~]# cd /var/cvs


Let's say you made a change to a file in CVS, commit the change, and the change you made has produced some problem, so you want to restore the file to the state it was in prior to the change you made to the file. What you are going to want to do first is to use the cvs log command to get the list of revisions. In this very simple example, the file has two revisions, 1.1 and 1.2. Let's say you want to restore the file back to the state it was in on revision 1.1.

~]# cvs log <file name>
total revisions: 2; selected revisions: 2
revision 1.2
date: 2018/02/28 07:50:56; author: Wendy; state: Exp; lines: +131 -188
Wendy's changes
revision 1.1
date: 2018/02/15 05:06:27; author: Jeremy; state: Exp;
Adding to CVS for the first time


At this point, it's usually a good idea to view the differences between the revisions, using the cvs diff command.

cvs diff -r 1.2 -r 1.1 <file name>


You can then use the cvs update command to update the file to the prior revision. In this example, the file would be restored to revision 1.1.

cvs update -j 1.2 -j 1.1 <file name>


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 ca956 in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |