w3reference home
CVS Tutorial


Bookmark and Share

Commit Command

The commit command saves the changes of the current working files into the repository.

So, when you make some change in a file in your working directory and commit it to the repository, will the changes reflect in the main file in the repository?
Well, the answer is both yes and no. The file is saved in the repository with the same name as the original one. But in fact, it is just a duplicate copy of the original file. The original file will remain intact.

If the name remains same, how will the duplicate file be distinguished from the original one?
Each file in the repository is assigned a revision number such as 1.1, 1.2 etc. This number is assigned automatically, internally. If at any point, one wants to checkout this file, he has to specify the revision number failing which he cannot view the file. The revision number is specified while checking out the file by using the -r option. What is the advantage of having revision numbers?
The fact that the original file remains intact ensures that you don't accidentally loose any data and apart from that, you can see what changes were made to a particular file, by which user, and when.

The syntax of the commit command is as follows:

cvs commit
Where is the file/folder name?
In case you do not mention the file name, the commit command causes all the files in the folder (and it's sub-folders) in which you have invoked the commit command to be committed to the repository with a new revision number.

Will all the files have a new revision number?
No. Only the files that have been modified will be committed and given a new revision number.

Now, if you want to commit a single file to the repository, the syntax is something like this:

cvs commit filename
Options of the commit command 1) -l
Only the files in the current working folder are committed. The files in the sub-folder are not committed.
2) -R
Commits the files in the sub-folders also. This option is set by default.
3) -r tag
Commits to the branch with tag tag.
4) -m msg
Saves msg as a message or log to be associated with the file. msg is like a comment or some additional information about the file. By using -m option, editor need not be invoked.
5) -D
This option assumes that all the files have been edited and causes all the files to be checked. The files are only checked and not committed.
6) -n
Does not run any module program.
7) -F filename
Reads the message or log of the file, filename, instead of invoking the editor.
8) -f
It causes the commit command to forcibly commit a new version of the file even if you have not edited the file.
9) -c
Checks for a valid edit on the file before committing.
10) -b bug
Only commits files that have been edited and marked with bug, bug.
11) -B bug
Marks committed files as belonging to bug, bug.
Code Validator
Learn FTP
Color finder
Link Checker
Free web designs
Coming soon!
Interview Questions...
'w3reference : Learn by examples ... Advanced to beginner's tutorials ...'
Ajax: AJAX tutorial1 | Apache: Apache HTTP Server | Restarting Apache | CSS: CSS Border | CSS Syntax | CSS Selector | CSS Comment | CVS: CVS Release | CVS Login | CVS Logout | CVS Annotate | Databases: Rolap Tutorial | OLAP Tutorial | OLTP Tutorial | data warehousing | Expect: HTML: html | Linux: Dot (.) conf files | Linux Mount Point | Linux Filesystem | SSH Tutorial | Linux Commands: cal | cat | cfdisk | chroot | MySQL: MySQL Commands | PHP: PHP Basics | PHP Variables | PHP Output (echo/print) | PHP String Concat | PL/SQL: PL/SQL Data Types | PL/SQL Control Structures | PL/SQL File Extensions | PL/SQL DBMS_OUTPUT package | Python: My first Python program | Shell: Starting Bash | Bash Redirection | Bash Pipes | Bash Variables | SQL: SQL Transactions | SQL Constraints | SQL Drop | SQL Union & Union All | SVN: svn architecture | SVN Repository | SVN Import | SVN Checkout | Tech: soap | Web Designing: Web Hosting | HTML/XHTML/CSS code validator | Learn FTP | Search Engine Optimization Tips | www: XML: XML vs HTML | XML Syntax | XML Tags, Elements and Attributes | XML Namespaces |
Sitemap | Disclaim | Privacy Policy | Contact | ©2007-2009 w3reference.com All Rights Reserved.