Using Merge To Yank A Change

I'll keep this one short. If you have a change that has been made to a file (or even to a change package of files) somewhere in the past and you would like to eliminate that change from the past, you can do so with a judicious use of almost any merge tool.

Most merge tools take, as parameters, a common ancestor file and two files that have been changed (from that ancestor) in parallel, perhaps repeatedly. If you look at the history of a file (and the extension to a change package is straightforward), and we'll keep this history really simple, you will see something like the following:

1.01 .. 1.02 .. 1.03 .. 1.04 .. 1.05 .. 1.06 .. 1.07

Let's assume that the change that created 1.04 (from 1.03) was not a good change and needs to be removed. Your merge tool can do this by considering 1.04 as the common ancestor, and 1.03 and 1.07 as parallel changes to 1.04. It may help to visualize it by pulling 1.03 out of the chain (or even making a copy of it) and considering it as a parallel branch created from 1.04.

The fact that it didn't happen that way doesn't really matter. If you compare 1.03 to 1.04, you will see the original change. If you compare 1.04 to 1.03, you will see the inverse change. The inverse change is going to be merged into 1.07. It is what actually causes the original change to be yanked.

I remember one time when we had integrated a merge tool into CM+ and mixed up the order of the file parameters to the merge tool. It was quite embarrassing as each reconcile operation (merge of a parallel checkout with the latest branch version), rather than reconciling the intermediate changes with the parallel checkout, yanked all the changes made by the parallel checkout. A quick edit of the configuration file to swap the order of the files quickly fixed the problem. I'm sure it made it quite clear to the user that a yank operation is nothing more than a merge operation.

When talking about individual files Neuma generally speaks about merging in four separate use cases:

  • Merge: Merge the contents of two parallel branches (typically into one of the branches)
  • Propagate: Merge a specific change into a branch from a parallel branch
  • Yank: The opposite of Propagate: remove a change introduced somewhere in the history of the branch
  • Reconcile: At checkin time, if the latest branch version doesn't match the checked out version, merge the changes into the checked out version.

About the author

Joe Farah's picture Joe Farah

Joe Farah is the President and CEO of Neuma Technology and is a regular contributor to the CM Journal. Prior to co-founding Neuma in 1990 and directing the development of CM+, Joe was Director of Software Architecture and Technology at Mitel, and in the 1970s a Development Manager at Nortel (Bell-Northern Research) where he developed the Program Library System (PLS) still heavily in use by Nortel's largest projects. A software developer since the late 1960s, Joe holds a B.A.Sc. degree in Engineering Science from the University of Toronto. You can contact Joe at

AgileConnection is one of the growing communities of the TechWell network.

Featuring fresh, insightful stories, is the place to go for what is happening in software development and delivery.  Join the conversation now!