cvs command in Linux with Examples
cvs(Concurrent Versions System) command in Linux is used to store the history of a file. Whenever a file gets corrupted or anything goes wrong “cvs” help us to go back to the previous version and restore our file.
Syntax:
cvs [cvs_options] cvs_command [command_options] [command_args]
Policy Options:
- –allow-root=rootdir : Specify repository on the command line. It also specify legal cvsroot directory. See ‘Password authentication server’ in the CVS manual.
- -d, cvs_root_directory : It uses cvs_root_directory as the directory path name of the repository. It also overrides the $CVSROOT environment variable.
- -e, editor-command : It uses the editor command specified for entering log information. It also overrides $CVSEDITOR and $EDITOR environment variables.
- -f : It does not read the ~/.cvsrc file.
- -H : It display CVS command help.
- -n : It does not make any changes to the root repository and also prints out what would happen if the “-n” flag was not used.
- -Q : Quiet mode. Less verbose than normal.
- -q : Marginally quiet mode. Reports of recursion are suppressed.
- -v : Show CVS software version and copyright information.
- -w : Make new working files read-write. Overrides the setting of the $CVSREAD environment variable.
CVS Commands:
- add : Add a new file/directory to the repository.
- admin : Administration front-end for RCS.
- annotate : Shows the last revision where each line was modified.
- checkout : Checkout sources for editing.
- commit : Check files into the repository.
- diff : Show differences between revisions.
- edit : Get ready to edit a watched file.
- editors : See who is editing a watched file.
- export : Export sources from CVS, similar to checkout.
- history : Show repository access history.
- import : Import sources into CVS, using vendor branches.
- init : It create a CVS repository if it doesn’t exist.
- log : Print out history information for files.
- rdiff : Create ‘patch’ format diffs between revisions.
- status : Display status information on checked out files.
- tag : It adds a symbolic tag to checked out version of files.
- unedit : Undo anedit command.
- update : Bring work tree in sync with repository.
- version : Show current CS version(s).
- watch : Set watches.
Setting up the environment for CVS:
- Set environment variables: (to add to your .bashrc file)
Syntax:
export CVSROOT='/home/linux/cvs_root' - directory for CVS source code repository export CVSEDITOR=/bin/vi
- Set environment variables: (to add to your .cshrc file) (for csh users)
Syntax:
setenv CVSROOT '/home/linux/cvs_root' setenv CVSEDITOR /bin/vi
Examples:
- To create a Repository (-d command ): The first thing to do after starting the environment is to create a repository.
cvs -d /home/linux/cvs_root init
- To add a Project (-m command ): After the repository is created, It’s time to create a project and add it into the CVS to have it’s revision control.
cvs import -m "CVS START" cvs_file myfile start
- To check out a Project (checkout or co command): This will help to create CVS working copy after the project is check out.
cvs checkout cvs_file
- To add Sub-directories or files (add command ): This will help to add files or sub-directories to the CVS repository.
cvs add cvs_file_1
- To commit the file (commit command ): This will help to permanently add files or sub-directories to the CVS repository.
cvs commit myfile
- To update the Working Directory (update command): It updates the working directory from the repository and also tells the status of files.
cvs update
- To remove file from CVS (remove command): It will help to remove unwanted files permanently from the CVS repository.
cvs remove myfile
Note:
- To check for the manual page of cvs command, use the following command:
man cvs
- To check the help page of cvs command, use the following command:
cvs --help command_name
Please Login to comment...