What is a Version control System?
In simple language, version control system is a database, which stores all the change records of your work. With the help of a version control system, you can make sync in a project while working in a team, whatever change is made by one team member is updated to a common database with the changes/comment/author’s name and the same can be accessed by other peoples whenever is required.
What is CVS?
The CVS (Concurrent Versions System) is a commonly used version control system among the software developers. It gives ease to work on same project by several users. Version control system software keeps track of all work and all changes in a set of files.
Frequently used commands in CVS
Here are some frequently used steps and relevant commands. Before using these commands, make sure the CVS is configured in your working environment and cvsroot is pointing to a desired location.
1. Add a new directory/file in the CVS Database:
cvs add <filename>
This command adds a desired “filename” in the CVS database. Note that this command adds only the file name. To update the file in the database, you need to use the check-in command (described in next point).
This command is used only once with a file/directory at first time.
2. Checking -in a file into CVS database:
After adding a filename, we need to put the whole file into the database using following commands.
cvs checkin -m “” <filename>
OR
cvs ci -m “” <filename>
OR
cvs commit -m “” <filename>
Here :
-m : is a message option to specify any short information about the change You can check in as many as versions of a file and each check in gives you a specific version No of the file
3. Checking out a file from CVS Database
cvs checkout “filename”
OR
cvs co “filename”
Here the filename can be a file or a directory.
The above command brings the latest available version of the given filename. The “filename” may ask to contain relative the path of the cvs directory structure.
4. Checking out a specific version of file.
If you want to get a specific version of file, please use following command –
cvs co -r <version> <file name>
5. Updating the files from database to your environment
This feature works same as CVS checkout. There are some minor changes than the checkout command.
Following command brings the required file(s) which are updated in the CVS but not synced with your environment.
cvs update < filename>
OR
cvs up <filename>
6. Tagging a file:
Tagging is a very useful feature given in the version control system. Suppose, you have achieved an intermediate milestone of a project and you have different files with different versions in the CVS database. Now you want to freeze them for the milestone, then you need to use a tag for them.
You can provide a same tag to all the relevant files from different versions and you can get them anytime by supplying the tag Info.
cvs tag <filename>
You can also use the wildcard characters for any of the cvs application.
7. Checking out a set of file from a given tag.
Now you want to bring all the files of the given tag.
cvs co -r <filename>
8. Deleting a tag :
Following command is used to delete a tag info from a file.
cvs ratg -d <tagname> <filename>
9. Creating a copy of the tag :
cvs rtag -r <current tag> <new tag> <filename>
10. Retagging of a file .
Let say after tagging of a set of files, you see an urgent change required in one of the file and you do not want to give any other tag name (due to any reason) for this small change. Then you need to retag the file. Please follow following steps.
A. copy the tag to an another temporary tag (this is required for records that the tag was changed)
cvs rtag -r <current tag> <new tag> <filename>
B. delete the current tag (This is required because you can not give a tag name which is already exists.)
cvs ratg -d <tag name> <filename>
C.Tag the file with a tagname
cvs tag <tagname> < filename>
11. Finding difference between files from two different versions
To see the difference in the files form two deferent cvs version can be seen by –
cvs diff -r <version1> -r <version2> <filename>
12. View CVS version information.
The see the log messages, which was given at the time of check in with -m option can be seen by
cvs log <filename>
To see the status of the file, whether is in sync with the database file of locally modified can be seen using –
cvs status <filename>
To view the tag information with the status use following command
cvs status -v <filename>