imagine you want to remodel your house, but you decide to put a team of programmers in charge of it.
The first thing the programmers will do is get a bunch of land and get a robot which can build an exact replica of your house, brick by brick, down to every detail. And the robot makes a replica of your house which we’ll call the master (replica) house. (Meanwhile, you keep living in your house.)
Then they get several plots of land, one plot of land for each programmer, and on each plot of land, they make another replica of the house (starting with the master replica), one house replica for each programmer.
Each programmer sets to work on his own separate house. When he’s done with something (say, replacing carpet throughout the house with wood floors), he tells the robot to come look at the progress he’s made, and the robot says “oh, fantastic! you’ve replaced the flooring!”, and then robot goes and replicates that in the master house, so the master house now has wood floors too.
As each programmer completes some changes, they tell the robot to go to the master house and mimic what they’ve done to theirs. Over time, someone paints the walls, someone else wires the house for home theater, someone else installs energy efficient air conditioning, and so on. And the robot keeps duplicating these changes on the master house. (From time to time, if convenient, the programmers may update their replica to be like the master currently is.) This is all working out quite well, and eventually when all this is done, the robot is going to come replace your house completely with this marvelous new, updated house (after you remove all your possessions).
But one day, something inconvenient happens. One programmer installs a hot tub behind the house and runs some power (for the heater) from the house. Another programmer knocks out a wall inside the house to make the living room bigger. The programmer who has knocked out a wall calls the robot over and says “have a look at my progress”. The robot says “well done” and knocks out the same wall in the master house.
But then the guy who has installed the hot tub calls the robot over to his house and says “now, have a look at myprogress”, and the robot says, “Ummmm, uhoh. That looks really nice, but you ran the power through the living room wall, and that wall doesn’t exist anymore.”
“What?!”, says the programmer. And the robot says, “The wall is gone. Oh, and I can’t do anything at all to the master house for you now, because I don’t know how to deal with running cable through a wall that doesn’t exist. That’s too complicated. You’ll have to sort it out on your own. Sorry.”
That is how code merging works 😛