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