To add elements (files and directories) to source control from the command line

About this task

You can add files or directories to source control at any time.

To add view-private files and directories to source control, or to make placeholders for nonexistent files and directories:

Procedure

  1. Go to the view used for your development task.

    The version-selection rules of your view determine the branch on which the first version of the element is created. Make sure your view creates versions on an appropriate branch.

  2. Change to the parent directory under which you want to add files and directories to source control.

    For snapshot views, the path from which you add to source control does not need to be loaded. However, it must match the VOB namespace.

  3. Check out the parent directory element by entering cleartool checkout -nc directory-name. Use the -nc option because appropriate comments are appended when you modify directory elements.
  4. Do one of the following:
    • To add a directory to source control, enter this command:
      cleartool mkdir directory-name
    • To add a file to source control, enter this command:
      cleartool mkelem file-name
    • To make placeholders for nonexistent objects, enter one of these commands:
      cleartool mkdir directory-element-path
      cleartool mkelem file-element-path
  5. After you add elements, check in the parent directory so that the elements are visible to others in the directory.
    
    cleartool checkin -nc .
    

Results

By default, when you add an element, it remains checked out. When you finish modifying the new elements, check them in. Elements that you add to a directory element are visible only in your view until you check in the directory.

For more information about the mkelem command, see the mkelem reference page in the DevOps Code ClearCase Command Reference.