Problem
Scope: this only applies to our repos in gitlab, mostly everything under https://gitlab.wikimedia.org/repos/cloud
There are 3 available merge strategies in gitlab.w.o:
By default, on repository creation, the first option is enabled.
The merge-commit strategy was made famous mostly by github, but it comes with a cost: it pollutes the git history with meaningless merge commits.
Constraints and risks
None. I don't think there is any particular risk or constraints associated with this decision request.
Decision record
Options
Each option is pretty well explained by gitlab itself, so I'm using screenshots.
Option 1
Keep merge-commit strategy.
See also https://gitlab.wikimedia.org/help/user/project/merge_requests/methods/index.md#merge-commit
Pros:
- Default
- Preserves the development history
- Preserves deployability (every commit in the main history line is one single change)
- History line is not mixed with development commits (like 'addressing comment X')
Cons:
- History is not linear
Option 2
Use merge-commit with semi-linear history.
Pros:
- Preserves deployability (every commit in the main history line is one single change)
- History is linear
- History line is not mixed with development commits (like 'addressing comment X')
- Preserves the development history
Cons:
- Not default
Option 3
Use fast-forward-only merges.
See also https://gitlab.wikimedia.org/help/user/project/merge_requests/methods/index.md#fast-forward-merge
Pros:
- History is linear
- Preserves the development history
Cons:
- Not default
- History line is mixed with development commits (like 'addressing comment X')
- Does not preserve deployability (most commits are only part of a change, hard to tell when the change starts/stops)
Option 4
Use squash + merge fast-forward
Setup the same as option 3 + squashing all the commits into one before
(https://docs.gitlab.com/ee/user/project/merge_requests/squash_and_merge.html)
Pros:
- History is linear
- Preserves deployability (each commit is a change)
- History line is not mixed with development commits (like 'addressing comment X')
Cons:
- Not default
- Does not preserve the development history