2 ms·
> What's the value prop of having the merge-commit in the history for you? The merge commit contains the sha values of the parent commits. For example, if mer
by u801e 4y ago
> What's the value prop of having the merge-commit in the history for you?
The merge commit contains the sha values of the parent commits. For example, if merged a branch that could otherwise be a fast forward merge using the --no-ff option, then you get a merge commit, but the commit does not change any of the files compared to the HEAD commit of the branch you merged.
Having the parent commit sha values allows you to see the commits that were in the branch that was merged even after it's merged. For example
git log merge-commit^1..merge-commit^2
Would show the commits made in that branch. Or you could run
git diff merge-commit^1..merge-commit^2
to get the overall diff introduced by the commits in that branch.
> These days, I usually advocate "squash & merge"
The disadvantage of doing that is that those commits can't be reverted easily (without conflicts). If the commits were separate, it's easier to revert a single one since it affects fewer files or lines within a file.