Improve merge commit diffs to see how conflicts are resolved
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Merge conflicts are common and can be resolved by either rebasing or with a merge commit. Merge commits can be a source of problems, either with a bad merge, or worse an evil merge that adds extra changes besides fixing the conflict. In GitLab it's hard to work out what happened in a merge commit, like merging master into a feature branch because it shows potentially hundreds of unrelated changes in the diff. We should find a smarter way to show this.
If you run git show <sha> on a merge commit, the diff that is output will show a diff of just the files where changes were merged, and which side the of the merge the changes came from.
For example, checkout gitlab-com/www-gitlab-com
- Unhelpful long diff:
git diff e9e2e1402^..e9e2e1402 - Compact nice diff:
git show e9e2e1402
Proposal
- Merge commit from the default branch into the feature branch should default to just showing the compact diff with a list of other files that changes were added to. (new behavior)
- We should provide a way to access the full diff if people want it too.
- Merge commit from a feature branch into the default branch should show all the changes (current behavior)
Links / references
https://stackoverflow.com/questions/27683077/how-do-you-detect-an-evil-merge-in-git