== 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:
{F35639794}
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 ==
`https://wikitech.wikimedia.org/wiki/Wikimedia_Cloud_Services_team/EnhancementProposals/Decision_record_T302593_How_do_we_make_decisions`
== Options ==
Each option is pretty well explained by gitlab itself, so I'm using screenshots.
=== Option 1 ===
Keep merge-commit strategy.
{F35639826}
See also https://gitlab.wikimedia.org/help/user/project/merge_requests/methods/index.md#merge-commit
Pros:
* the default.
Cons:
* pollutes the git history for no added value.==== 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.
{F35639841}
See also https://gitlab.wikimedia.org/help/user/project/merge_requests/methods/index.md#merge-commit-with-semi-linear-history
Pros:
* TBD.
Cons:
* pollutes the git history for no added value.==== Pros:
* since it is not the default, every repository should be configured to use this. No big deal on the other hand, just a few clicks. If we had 100s of repos, we could automate it via the REST API.
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.
{F35639857}
See also https://gitlab.wikimedia.org/help/user/project/merge_requests/methods/index.md#fast-forward-merge
Pros:==== 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)
* clean git history, no useless merge commits.=== Option 4
* similar to what most of the main gerrit repos have (`ops/puppet.git` etc)Use squash + merge fast-forward
Cons: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)
* since it is not the default, every repository should be configured to use this. No big deal on the other hand, just a few clicks. If we had 100s of repos, we could automate it via the REST API.==== 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