3 ms·
For me, a merge commit in git is just a snapshot like any other except that its metadata contains links to more than one parent. The parent child relationship
by derriz 6y ago
For me, a merge commit in git is just a snapshot like any other except that its metadata contains links to more than one parent.
The parent child relationship acts as nothing more than remark that the child was derived from both parents in some way.
Of course, commonly the child is derived by finding the most recent common parent, using heuristics to guess file identities after any renaming and then performing a 3-way line-based diff between what it thinks are corresponding files.
But actually git doesn't really care - it's just another snapshot you've created and added to the DAG.
I haven't found it helpful to think of what's going on in git in terms of an "accumulated file diffs" abstraction because git has no notion of file identity (across commits).