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