We help IT Professionals succeed at work.

copy contents of one branch into another branch in unix clearcase

gram77 asked
Last Modified: 2013-11-25
I have created 2 new branch types

ct mkbrtype dev_branch1


ct mkbrtype dev_branch2

I have checkedin code into dev_branch1
How do i copy contents of dev_branch1 into dev_branch2, including all versions of files, everything
Watch Question

This one is on us!
(Get your first solution completely free - no credit card required)


We checkin code into mydev_branch1 and merge it to mydev_branch2

However, i want to work in a dummy branch type mydev_branch3 and merge it to dummy dev branch type mydev_branch4

when i have finished working on mydev_branch3 i want to copy checkedin code into mydev_branch1
and merge mydev_branch1 into mydev_branch2. This way i won't have many versions created of a file.

basically copy contents of mydev_branch1 into mydev_branch3

mydev_branch1 and mydev_branch3 are not related.

This really seems like a strange way to work..! I don't understand why you want to limit the number of versions. Why are you not delivering / merging the contents of you development stream onto an integration stream / release branch.

When you say
mydev_branch1 and mydev_branch3 are not related
does that mean that they are in different VOBs.

clearfsimport wouild be one way to update mydev_branch3 with the contents of mydev_branch1.



does that mean that they are in different VOBs.>> no they are under same VOB.

also please provide example of using clearfsimport. will it copy all elements from elementtype into another elementtype?

If the two branches are in the same vob and have a common ancestor then the best way to do this is with merge and findmerge I think.

To update the contents of folder A with the contents of folder B using clearfsimport the commands would be something like:

cd <root folder of destination>
clearfsimport -rec -rmname <list of files and folders in source folder> .

Open in new window

You may need to look at the man page for clearfsimport to be sure that I've gotten the syntax correct. A graphical representation of your streaming diagram may help.

Obviously try all this out in a test VOB first and make sure you have backups etc...



Here is an excellent material on Clearfsimport.

seems this is a very powerfull tool!

A lot of folks use rational Clear Case LT explorer on Windows to checkin and checkout files. A few who hate to transfer files around will install their Clear Case client on Unix and work with
"cleartool checkout"
"cleartool checkin"
you can take it to the next step. A huge working directory , you ve worked on several scripts - to checkout and check in each one of them can be cumbersome.

"Clearfsimport" is a powerful utility - you can simply do a Recursive Filesystem compare between your VOB and your working directory--->all the rest is taken care of. ClearfsImport will determine what files are newelements(add them to src control), what has changed and update the changed files without the need to checkout and checkin files.
Works great----especially if you work on a lot of code , you don't want to spend an entire day figuring out what to checkin and checkout.

syntax for clearfsimport:
cd to your VOB dir(note you should be in your VOB dir while running clearfsimport)
clearfsimport -preview -recurse -follow -nsetevent your_working_dir .
(the above command will give you a preview of what is going to happen)

clearfsimport -recurse -follow -nsetevent your_working_dir .
will get your VOB in sync with your working dir.


Celarfsimport as described above does not do a vob element to vob element transfer, it updates the vob with contents of your working directory.


I would rather go with the clearfsimport script, better equipped to import multiple times the same set of files, and automatically:

add new files,
make new version of existing files previously imported (but modified in the source set of files re-imported)
remove files already imported but no longer present in the source set of files.
make a clear log of all operations made during the import process.

So if your 'zip-file delivery needs to be updated on a regularly basis, clearfsimport is the way to go, but with the following options:

clearfsimport -preview -rec -nset c:\sourceDir\* m:\MyView\MyVob\MyDestinationDirectory


The clearfsimport command reads the specified file system source objects and places them in the target VOB. This command uses magic files to determine which element type to use for each element created (see the cc.magic reference page). The source and target directories may not be the same; to create an element from a view-private object that already resides in the target directory, use mkelem.
1.Preview a VOB—/vobs/projectx/src—that is to be populated with the contents of /usr/src/projectx. Recursively descend all directories encountered and follow UNIX or Linux symbolic links to the target objects.
clearfsimport –preview –follow –recurse /usr/src/projectx
2.Convert a .txt file to an element and place it in the VOB lli_vob1.
D:\lli_work>clearfsimport Reqpro_setup.txt M:\lli_nt_view\lli_vob1
Validating directory "M:\lli_nt_view\lli_vob1".
Creating element "M:\lli_nt_view\lli_vob1\Reqpro_setup.txt".
version "\main\1".
Closing directories.
Checked in version "main\1" of directory "M:\lli_nt_view\lli_vob1"


well, you made me stumble on a very useful utility, but this does not transfer vob-to-vob, but file system to vob

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.