| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> | |
| <HTML> | |
| <HEAD> | |
| <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> | |
| <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> | |
| <LINK REL="STYLESHEET" HREF="../book.css" CHARSET="ISO-8859-1" TYPE="text/css"> | |
| <title>Version control life cycle: adding and ignoring resources</title> | |
| <meta name="keyword" content="team"> | |
| </HEAD> | |
| <BODY BGCOLOR="#ffffff"> | |
| <H1 CLASS="Head">Version control life cycle: adding and ignoring resources</H1> | |
| <p>When committing resources, often there are resources that you do not want to | |
| store in the repository. For example, external editors might create temporary | |
| files in your project, compilation of .java files might create .class files, | |
| or some build operations might result in binary files. When put together, these | |
| generated files may be quite large. They may also be regenerated whenever | |
| a build is performed, resulting in many outgoing changes. Typically these are | |
| not files that one wants to persist in the repository or to share with other | |
| members of a team. | |
| </p> | |
| <p>Team CVS has two related tasks that allow you to control which files are stored | |
| in the repository: adding a resource to version control, and ignoring a resource. | |
| </p> | |
| <h2>Adding a file to version control</h2> | |
| <p>Team CVS does not automatically add files to version control. Rather, it's | |
| your choice to explicitly add files to version control. This is accomplished | |
| by selecting the <b>Team > Add to Version Control</b> menu. | |
| </p> | |
| <p>When performed on a file, it will add that file to version control. The result | |
| is that the CVS repository immediately creates an entry so that it can | |
| start maintaining history state for that file. This occurs even before you commit | |
| the file to the repository. | |
| </p> | |
| <p>When adding a folder or project, the action will recursively descend into sub-folders, | |
| adding those files it finds to version control, provided the files have not | |
| been explicitly ignored. </p> | |
| <p><em>Tip:</em> When committing files, if the selection either directly or recursively | |
| contains files which have not been added to version control, you will be prompted | |
| whether or not you want them added. This is a convenience function to help ensure | |
| that you do not miss committing new resources which were unintentionally never | |
| added. </p> | |
| <h2><i>How may I ignore thee, let me count the ways</i></h2> | |
| <P>There are several facilities that allow you to specify which resources should | |
| be excluded from version control: | |
| </P> | |
| <ol> | |
| <li>There is a global preference which you can use for ignoring files and directories | |
| that match a certain filename pattern. For example, if you create a global | |
| ignore for <samp>/bin</samp>, and any resource that matches "bin" | |
| in any directory in the workspace will be ignored for version control. This | |
| preference can be found in <b>Window > Preferences > Team > Ignored Resources</b>.</li> | |
| <li>Any resource marked as <i>derived</i> will be automatically ignored for | |
| version management by Team CVS. Some builders, such as the Java builder, mark | |
| all of its build output (e.g. .class files) as derived.</li> | |
| <li>CVS supports the creation of a special <i>.cvsignore</i> file whose contents | |
| describe which files or folders to ignore for version management. The .cvsignore | |
| file only applies the pattern to resources in the <i> same</i> directory as | |
| the .cvsignore file itself.</li> | |
| </ol> | |
| <P><em>Tip</em>: Once a resource is under version control, it cannot easily be | |
| subsequently ignored. This is why adding to version control is an explicit operation | |
| performed by you the user. | |
| </P> | |
| <p><img border="0" src="../images/ngrelc.gif" alt="Related concepts" width="159" height="27"><br> | |
| <a href="../concepts/concepts-26.htm">Team programming with CVS</a><br> | |
| </p> | |
| <p><img border="0" src="../images/ngrelt.gif" alt="Related tasks" width="159" height="27"><br> | |
| <a href="tasks-100d1.htm">Creating a global ignore pattern</a><br> | |
| <a href="tasks-100d2.htm">Authoring the CVS .cvsignore file</a><br> | |
| <a href="tasks-114.htm">Committing</a><br> | |
| <a href="tasks-113.htm">Updating</a> | |
| </p> | |
| <p> <br> | |
| <a href="../hglegal2003.htm"><img src="../images/ngibmcpy2003.gif" alt="Copyright IBM Corporation and others 2000, 2003" border="0" width="324" height="14"></a> | |
| </p> | |
| </BODY> | |
| </HTML> |