Jon Aquino's Mental Garden

Engineering beautiful software jon aquino labs | personal blog

Friday, November 06, 2009

How merging works the second, third, etc. time you merge a file?

I asked a programming question on for the first time today. I was pleasantly surprised to get an answer in 9 minutes.

My question was about how revision-control systems do repeated merging between two branches. I understand that the first merge is a 3-way merge between two files and their common parent. But I didn't know what happens on the second, third, etc. merge: what are the 3 files involved in the 3-way merge at that point?

Greg Hewgill gave me a great answer—in short, use the two files and their “closest common parent”. See Greg's answer for a nice diagram of this. It was an Aha! moment for me.


Post a Comment

<< Home