Search code examples
version-controlbranchclearcase

How to delete a clearcase branch with a single command?


I've accidentally created a branch with the wrong config spec and I've made a merge in there that wasn't meant to be done. Is there a way to remove this branch like it never existed, with one and only command? There are no checked-out files in the branch.

I could go through all files and do it manually since there are only 3 files that were merged. But what if there were 3000 instead of 3?


Solution

  • You can try and delete the byrtpe (branch type) with cleartool rmtype brtype:xxx.

    That is possible only if you are talking about a brand new branch, which was used only in this instance (that is, where you need to delete all instances of that branch type: an instance of a branch type is a branch created to reference a version at a checkin).

    Then (if the only versions in that branches are the wrong merged ones), you could do:

    cleartool rmtype -rmall brtype:yourBranch@\avob
    

    Again, that is a dangerous command, and should only be used for a new branch with a few versions.

    The -rmall will first remove all branch type instances (ie the actual branches, and their associated versions and labels).
    Then the branch type itself will be removed.