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