The way a merge works in Git, ignoring renames, is that Git considers three points in the history: the heads of the two branches, and the merge base, which is usually the most recent common ancestor. Git merges by looking at the changes between the merge base and each head (usually a branch).
If one side contains a change, such as on mybranch
, but the other does not, such as master
, then the result of the merge is the change. This is the goal of why one performs a merge in the first place. If both sides have identical changes or neither side has a change, then Git takes the version that's common. A conflict occurs only if both sides have different changes in the same area, since Git then doesn't know what to do.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…