How to merge new version and old version file in c

2019-05-30 10:03发布

问题:

Let say I have checked out a file "file.c" from main line. In that file suppose there is only one function say "add()".

I am going to implement one more function in that file say "subtract()" for that I checked out the file and I've implemented "subtract()" function.

Now, suppose in the same file another person implemented a new function say "multiply()" and he check in that file to main line and the new version is created for that file in the main line.

My question is: the file which I've checked out in my activity branch is having two function one is "add()" which was already there and one function is "subtract()" which is implemented by me.

I want the third function i.e. "multiply()" in my file without affecting my changes in my activity branch. I don't want to do check in to the main line, just I want all three functions in my checked out file.
So my file will contain three functions add(), subtract(), and multiply().

How can I do that (without a checking triggering the mergetool)?

回答1:

The easiest way is to:

  • have a separate dynamic view, which reflects at all times the latest (including the file with multiply in it)
  • make a simple copy-paste of the section of interest of that file to your checked out file

That way, you don't have to check-in immediately.

If there are too many change to copy manually, use a diff tool in order to detect changes between the file from the dynamic view and the one in your view, currently checked out.



标签: clearcase