2

I an new to ClearCase and started studying the ClearCase documentation.

UseCase : I have two branches - 'Branch_A' and 'Branch_B'.
I need to merge all my changes from 'Branch_A' to 'Branch_B'

I won't be able to use the ClearTeamExplorer, so only option is command line.

I read the documentation and its mentioned that cleartool findmerge command is the option for it.

But there is no direct example given for this.
Could someone please provide an command line example for this please?

Any help on this is appreciated.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Harry
  • 3,072
  • 6
  • 43
  • 100

1 Answers1

2

Assuming a base ClearCase view/branch (no UCM views/Streams):

cleartool findmerge include a relevant example:

for the current directory subtree, compare versions visible in the current view against versions on another branch and perform any required merges.

cd /path/to/target/Branch_B/view
cleartool findmerge . –fversion /main/Branch_A/LATEST –merge –gmerge.

The idea is to be in the view set on the target branch, with a config spec ready to create new versions.

element * CHECKEDOUT
element * .../Branch_B/LATEST
element * /main/0 -mkbranch Branch_B
element * /main/LATEST -mkbranch Branch_B

The merge is done in the target view, on the target branch.


Now if you are using UCM, then the view done on a Stream has already the right config spec.
The idea remains the same: Execute the findmerge in the target view (after setting a dedicated activity, to record that merge)

In that case, check "How to merge changes from a specific UCM activity from one ClearCase stream to another"

You do not merge branches in UCM, you would merge UCM activities.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thank you so much @vonc , findmerge- will it override all the changes in the branch_b, I need to overwrite all the changes in the branch_b with branch_a – Harry Aug 11 '22 at 16:15
  • 1
    @Harry Indeed: you need a view (set on Branch_B) where there is no checkout/change in progress. – VonC Aug 11 '22 at 16:35
  • How to revert / update the conflicted files? Any help on this is appreciated. – Harry Aug 12 '22 at 11:57
  • @Harry on the revert side: https://www.ibm.com/support/pages/viewing-previous-version-file-element-without-modifying-views-config-spec, or, in command-line, [`cleartool get`](https://stackoverflow.com/a/177350/6309). – VonC Aug 12 '22 at 12:30
  • @Harry On the merge side, if possible, launch a graphical merge: https://stackoverflow.com/a/44543865/6309 – VonC Aug 12 '22 at 12:59
  • @harry a merge won't always overwrite changes made on a branch with changes from another. This is particularly true of directories and text files. You can create element types with "copy" merge behavior, and this would do what you stated. – Brian Cowan Aug 12 '22 at 13:31