186d7f5d3SJohn MarinoDate: Tue, 16 Jun 1992 17:05:23 +0200 286d7f5d3SJohn MarinoFrom: Steven.Pemberton@cwi.nl 386d7f5d3SJohn MarinoMessage-Id: <9206161505.AA06927.steven@sijs.cwi.nl> 486d7f5d3SJohn MarinoTo: berliner@Sun.COM 586d7f5d3SJohn MarinoSubject: cvs 686d7f5d3SJohn Marino 786d7f5d3SJohn MarinoINTRODUCTION TO USING CVS 886d7f5d3SJohn Marino 986d7f5d3SJohn Marino CVS is a system that lets groups of people work simultaneously on 1086d7f5d3SJohn Marino groups of files (for instance program sources). 1186d7f5d3SJohn Marino 1286d7f5d3SJohn Marino It works by holding a central 'repository' of the most recent version 1386d7f5d3SJohn Marino of the files. You may at any time create a personal copy of these 1486d7f5d3SJohn Marino files; if at a later date newer versions of the files are put in the 1586d7f5d3SJohn Marino repository, you can 'update' your copy. 1686d7f5d3SJohn Marino 1786d7f5d3SJohn Marino You may edit your copy of the files freely. If new versions of the 1886d7f5d3SJohn Marino files have been put in the repository in the meantime, doing an update 1986d7f5d3SJohn Marino merges the changes in the central copy into your copy. 2086d7f5d3SJohn Marino (It can be that when you do an update, the changes in the 2186d7f5d3SJohn Marino central copy clash with changes you have made in your own 2286d7f5d3SJohn Marino copy. In this case cvs warns you, and you have to resolve the 2386d7f5d3SJohn Marino clash in your copy.) 2486d7f5d3SJohn Marino 2586d7f5d3SJohn Marino When you are satisfied with the changes you have made in your copy of 2686d7f5d3SJohn Marino the files, you can 'commit' them into the central repository. 2786d7f5d3SJohn Marino (When you do a commit, if you haven't updated to the most 2886d7f5d3SJohn Marino recent version of the files, cvs tells you this; then you have 2986d7f5d3SJohn Marino to first update, resolve any possible clashes, and then redo 3086d7f5d3SJohn Marino the commit.) 3186d7f5d3SJohn Marino 3286d7f5d3SJohn MarinoUSING CVS 3386d7f5d3SJohn Marino 3486d7f5d3SJohn Marino Suppose that a number of repositories have been stored in 3586d7f5d3SJohn Marino /usr/src/cvs. Whenever you use cvs, the environment variable 3686d7f5d3SJohn Marino CVSROOT must be set to this (for some reason): 3786d7f5d3SJohn Marino 3886d7f5d3SJohn Marino CVSROOT=/usr/src/cvs 3986d7f5d3SJohn Marino export CVSROOT 4086d7f5d3SJohn Marino 4186d7f5d3SJohn MarinoTO CREATE A PERSONAL COPY OF A REPOSITORY 4286d7f5d3SJohn Marino 4386d7f5d3SJohn Marino Suppose you want a copy of the files in repository 'views' to be 4486d7f5d3SJohn Marino created in your directory src. Go to the place where you want your 4586d7f5d3SJohn Marino copy of the directory, and do a 'checkout' of the directory you 4686d7f5d3SJohn Marino want: 4786d7f5d3SJohn Marino 4886d7f5d3SJohn Marino cd $HOME/src 4986d7f5d3SJohn Marino cvs checkout views 5086d7f5d3SJohn Marino 5186d7f5d3SJohn Marino This creates a directory called (in this case) 'views' in the src 5286d7f5d3SJohn Marino directory, containing a copy of the files, which you may now work 5386d7f5d3SJohn Marino on to your heart's content. 5486d7f5d3SJohn Marino 5586d7f5d3SJohn MarinoTO UPDATE YOUR COPY 5686d7f5d3SJohn Marino 5786d7f5d3SJohn Marino Use the command 'cvs update'. 5886d7f5d3SJohn Marino 5986d7f5d3SJohn Marino This will update your copy with any changes from the central 6086d7f5d3SJohn Marino repository, telling you which files have been updated (their names 6186d7f5d3SJohn Marino are displayed with a U before them), and which have been modified 6286d7f5d3SJohn Marino by you and not yet committed (preceded by an M). You will be 6386d7f5d3SJohn Marino warned of any files that contain clashes, the clashes will be 6486d7f5d3SJohn Marino marked in the file surrounded by lines of the form <<<< and >>>>. 6586d7f5d3SJohn Marino 6686d7f5d3SJohn MarinoTO COMMIT YOUR CHANGES 6786d7f5d3SJohn Marino 6886d7f5d3SJohn Marino Use the command 'cvs commit'. 6986d7f5d3SJohn Marino 7086d7f5d3SJohn Marino You will be put in an editor to make a message that describes the 7186d7f5d3SJohn Marino changes that you have made (for future reference). Your changes 7286d7f5d3SJohn Marino will then be added to the central copy. 7386d7f5d3SJohn Marino 7486d7f5d3SJohn MarinoADDING AND REMOVING FILES 7586d7f5d3SJohn Marino 7686d7f5d3SJohn Marino It can be that the changes you want to make involve a completely 7786d7f5d3SJohn Marino new file, or removing an existing one. The commands to use here 7886d7f5d3SJohn Marino are: 7986d7f5d3SJohn Marino 8086d7f5d3SJohn Marino cvs add <filename> 8186d7f5d3SJohn Marino cvs remove <filename> 8286d7f5d3SJohn Marino 8386d7f5d3SJohn Marino You still have to do a commit after these commands. You may make 8486d7f5d3SJohn Marino any number of new files in your copy of the repository, but they 8586d7f5d3SJohn Marino will not be committed to the central copy unless you do a 'cvs add'. 8686d7f5d3SJohn Marino 8786d7f5d3SJohn MarinoOTHER USEFUL COMMANDS AND HINTS 8886d7f5d3SJohn Marino 8986d7f5d3SJohn Marino To see the commit messages for files, and who made them, use: 9086d7f5d3SJohn Marino 9186d7f5d3SJohn Marino cvs log [filenames] 9286d7f5d3SJohn Marino 9386d7f5d3SJohn Marino To see the differences between your version and the central version: 9486d7f5d3SJohn Marino 9586d7f5d3SJohn Marino cvs diff [filenames] 9686d7f5d3SJohn Marino 9786d7f5d3SJohn Marino To give a file a new name, rename it and do an add and a remove. 9886d7f5d3SJohn Marino 9986d7f5d3SJohn Marino To lose your changes and go back to the version from the 10086d7f5d3SJohn Marino repository, delete the file and do an update. 10186d7f5d3SJohn Marino 10286d7f5d3SJohn Marino After an update where there have been clashes, your original 10386d7f5d3SJohn Marino version of the file is saved as .#file.version. 10486d7f5d3SJohn Marino 10586d7f5d3SJohn Marino All the cvs commands mentioned accept a flag '-n', that doesn't do 10686d7f5d3SJohn Marino the action, but lets you see what would happen. For instance, you 10786d7f5d3SJohn Marino can use 'cvs -n update' to see which files would be updated. 10886d7f5d3SJohn Marino 10986d7f5d3SJohn MarinoMORE INFORMATION 11086d7f5d3SJohn Marino 11186d7f5d3SJohn Marino This is necessarily a very brief introduction. See the manual page 11286d7f5d3SJohn Marino (man cvs) for full details. 113