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