Suppose I've checked-out a file foo
on a ClearCase view, which triggered the creating of a version of that file with branch name my_branch
- the first version for that file with that branch name. Now I've un-checked-out the file - but version-0 of it with that branch name remains. How can I remove it? I know there's some way to do it using a "trigger" (I'm not quite familiar with those); can I just remove it manually with some command?
Note: my_branch
has versions of other files on it; it shouldn't be removed entirely.
For a single file, as requested in the OP:
The (dangerous) command would be cleartool rmver
cleartool rmver util.c@@/main/my_branch/0
That would be the manual approach, assuming my_branch
is created from main
.
As illustrated here, in order for the version to not leave any dangling element (branch, label, hyperlink or attribute metadata), you would need:
cleartool rmver –xbranch –xlabel –xattr –xhlink util.c@@/main/my_branch/0
(assuming the version 0 is the only version on that branch)
As I mentioned in "how to remove a version in ClearCase", if you have inadvertently created some version-0's on a branch, the better way to remove them - all of them - is to use cleartool rmbranch
:
"cleartool rmbranch -force $myBranch"
You can see it used in "Command to delete branches of Clearcase element with “0” versions".
But that would be for the all branch indeed. Not for a single file.
The automatic approach is put in place through a mktrtype, as I documented here.
As a script, you can use:
That does use a trigger: I mention it here just for the sake of completeness, even though it is not your preferred approach.
For a occasional cleanup, rmver
is enough for a lone 0 version.
(for any other case, as discussed here, rmver
is dangerous)