Sub-feature proposal: Partial Squash & Merge
Description
Sometimes we want to squash and merge a merge request which has hundreds of minor edits to avoid adding all of that minor edits commits to the master branch (or any default branch). Currently we have 2 options:
- Squash and merge: turns the entire commit history into one single commit, attributed to the MR's author. The contribution history can only be accessed from the MR
- Just merge: add hundreds of simple commits (fixing typos and such)
Proposal
Create a way to squash partially, then merge.
When the "partial squash" checkbox (as we have for squash commits) is checked, when a user clicks "merge", it prompts a list of commits they want to squash. They select them, and squash. Then it prompts you an option to squash again, so you can group commits per file.
It's important to attribute a different user to that commit rather than the MR author. We can either present a way to select the user (another list) or, attribute the new commit to the last commit author.
Maybe we could create a [squash]
tag as we have for [ci skip]
, from which we squash a commit as long as the tag is added to the commit message?
Links / references
Documentation blurb
To be added if we go for it
Use cases
A practical example would be using this feature to our release posts. They're a good example of having hundreds of minor-edit commits that we want to squash. We have squashed them for the last release posts, but all the edits to all files go as one commit by the MR author. If we want to whatever reason find the person who added something, we need to go back to the MR and search for the person who added that commit (hopefully with a good commit message).
For this reason, it would be cool if we could group some commits (partially squash them), attribute to the person who added them (usually a Product Manager), make sure we have a decent commit history, then merge.
Ref: https://gitlab.slack.com/archives/C3TRESYPJ/p1495481553780747 //
Feature checklist
Make sure these are completed before closing the issue, with a link to the relevant commit.
-
Feature assurance -
Documentation -
Added to features.yml