xref: /openbsd-src/gnu/usr.bin/cvs/contrib/intro.doc (revision 1e72d8d26fae84dfb4bcd4cecabd10b989ec3f29)
1*1e72d8d2SderaadtDate: Tue, 16 Jun 1992 17:05:23 +0200
2*1e72d8d2SderaadtFrom: Steven.Pemberton@cwi.nl
3*1e72d8d2SderaadtMessage-Id: <9206161505.AA06927.steven@sijs.cwi.nl>
4*1e72d8d2SderaadtTo: berliner@Sun.COM
5*1e72d8d2SderaadtSubject: cvs
6*1e72d8d2Sderaadt
7*1e72d8d2SderaadtINTRODUCTION TO USING CVS
8*1e72d8d2Sderaadt
9*1e72d8d2Sderaadt    CVS is a system that lets groups of people work simultaneously on
10*1e72d8d2Sderaadt    groups of files (for instance program sources).
11*1e72d8d2Sderaadt
12*1e72d8d2Sderaadt    It works by holding a central 'repository' of the most recent version
13*1e72d8d2Sderaadt    of the files.  You may at any time create a personal copy of these
14*1e72d8d2Sderaadt    files; if at a later date newer versions of the files are put in the
15*1e72d8d2Sderaadt    repository, you can 'update' your copy.
16*1e72d8d2Sderaadt
17*1e72d8d2Sderaadt    You may edit your copy of the files freely. If new versions of the
18*1e72d8d2Sderaadt    files have been put in the repository in the meantime, doing an update
19*1e72d8d2Sderaadt    merges the changes in the central copy into your copy.
20*1e72d8d2Sderaadt	(It can be that when you do an update, the changes in the
21*1e72d8d2Sderaadt	central copy clash with changes you have made in your own
22*1e72d8d2Sderaadt	copy. In this case cvs warns you, and you have to resolve the
23*1e72d8d2Sderaadt	clash in your copy.)
24*1e72d8d2Sderaadt
25*1e72d8d2Sderaadt    When you are satisfied with the changes you have made in your copy of
26*1e72d8d2Sderaadt    the files, you can 'commit' them into the central repository.
27*1e72d8d2Sderaadt	(When you do a commit, if you haven't updated to the most
28*1e72d8d2Sderaadt	recent version of the files, cvs tells you this; then you have
29*1e72d8d2Sderaadt	to first update, resolve any possible clashes, and then redo
30*1e72d8d2Sderaadt	the commit.)
31*1e72d8d2Sderaadt
32*1e72d8d2SderaadtUSING CVS
33*1e72d8d2Sderaadt
34*1e72d8d2Sderaadt    Suppose that a number of repositories have been stored in
35*1e72d8d2Sderaadt    /usr/src/cvs. Whenever you use cvs, the environment variable
36*1e72d8d2Sderaadt    CVSROOT must be set to this (for some reason):
37*1e72d8d2Sderaadt
38*1e72d8d2Sderaadt	CVSROOT=/usr/src/cvs
39*1e72d8d2Sderaadt	export CVSROOT
40*1e72d8d2Sderaadt
41*1e72d8d2SderaadtTO CREATE A PERSONAL COPY OF A REPOSITORY
42*1e72d8d2Sderaadt
43*1e72d8d2Sderaadt    Suppose you want a copy of the files in repository 'views' to be
44*1e72d8d2Sderaadt    created in your directory src. Go to the place where you want your
45*1e72d8d2Sderaadt    copy of the directory, and do a 'checkout' of the directory you
46*1e72d8d2Sderaadt    want:
47*1e72d8d2Sderaadt
48*1e72d8d2Sderaadt	cd $HOME/src
49*1e72d8d2Sderaadt	cvs checkout views
50*1e72d8d2Sderaadt
51*1e72d8d2Sderaadt    This creates a directory called (in this case) 'views' in the src
52*1e72d8d2Sderaadt    directory, containing a copy of the files, which you may now work
53*1e72d8d2Sderaadt    on to your heart's content.
54*1e72d8d2Sderaadt
55*1e72d8d2SderaadtTO UPDATE YOUR COPY
56*1e72d8d2Sderaadt
57*1e72d8d2Sderaadt    Use the command 'cvs update'.
58*1e72d8d2Sderaadt
59*1e72d8d2Sderaadt    This will update your copy with any changes from the central
60*1e72d8d2Sderaadt    repository, telling you which files have been updated (their names
61*1e72d8d2Sderaadt    are displayed with a U before them), and which have been modified
62*1e72d8d2Sderaadt    by you and not yet committed (preceded by an M). You will be
63*1e72d8d2Sderaadt    warned of any files that contain clashes, the clashes will be
64*1e72d8d2Sderaadt    marked in the file surrounded by lines of the form <<<< and >>>>.
65*1e72d8d2Sderaadt
66*1e72d8d2SderaadtTO COMMIT YOUR CHANGES
67*1e72d8d2Sderaadt
68*1e72d8d2Sderaadt    Use the command 'cvs commit'.
69*1e72d8d2Sderaadt
70*1e72d8d2Sderaadt    You will be put in an editor to make a message that describes the
71*1e72d8d2Sderaadt    changes that you have made (for future reference). Your changes
72*1e72d8d2Sderaadt    will then be added to the central copy.
73*1e72d8d2Sderaadt
74*1e72d8d2SderaadtADDING AND REMOVING FILES
75*1e72d8d2Sderaadt
76*1e72d8d2Sderaadt    It can be that the changes you want to make involve a completely
77*1e72d8d2Sderaadt    new file, or removing an existing one. The commands to use here
78*1e72d8d2Sderaadt    are:
79*1e72d8d2Sderaadt
80*1e72d8d2Sderaadt	cvs add <filename>
81*1e72d8d2Sderaadt	cvs remove <filename>
82*1e72d8d2Sderaadt
83*1e72d8d2Sderaadt    You still have to do a commit after these commands. You may make
84*1e72d8d2Sderaadt    any number of new files in your copy of the repository, but they
85*1e72d8d2Sderaadt    will not be committed to the central copy unless you do a 'cvs add'.
86*1e72d8d2Sderaadt
87*1e72d8d2SderaadtOTHER USEFUL COMMANDS AND HINTS
88*1e72d8d2Sderaadt
89*1e72d8d2Sderaadt    To see the commit messages for files, and who made them, use:
90*1e72d8d2Sderaadt
91*1e72d8d2Sderaadt	cvs log [filenames]
92*1e72d8d2Sderaadt
93*1e72d8d2Sderaadt    To see the differences between your version and the central version:
94*1e72d8d2Sderaadt
95*1e72d8d2Sderaadt	cvs diff [filenames]
96*1e72d8d2Sderaadt
97*1e72d8d2Sderaadt    To give a file a new name, rename it and do an add and a remove.
98*1e72d8d2Sderaadt
99*1e72d8d2Sderaadt    To lose your changes and go back to the version from the
100*1e72d8d2Sderaadt    repository, delete the file and do an update.
101*1e72d8d2Sderaadt
102*1e72d8d2Sderaadt    After an update where there have been clashes, your original
103*1e72d8d2Sderaadt    version of the file is saved as .#file.version.
104*1e72d8d2Sderaadt
105*1e72d8d2Sderaadt    All the cvs commands mentioned accept a flag '-n', that doesn't do
106*1e72d8d2Sderaadt    the action, but lets you see what would happen. For instance, you
107*1e72d8d2Sderaadt    can use 'cvs -n update' to see which files would be updated.
108*1e72d8d2Sderaadt
109*1e72d8d2SderaadtMORE INFORMATION
110*1e72d8d2Sderaadt
111*1e72d8d2Sderaadt    This is necessarily a very brief introduction. See the manual page
112*1e72d8d2Sderaadt    (man cvs) for full details.
113