I think there are some points to consider:
- Forge-focused development (pull requests)
- Using merges to mark where features where incorporated
- Rebase as cherry-picks
- Not wanting to change incoming commit messages
I think many projects that use Git can get very forge-focused. Meaning
that they end up using the information in the forge-only pull request
link.
The standard merge message is convenient for that:
Merged xzy into `master` (PR #789)
Now if you’re viewing the commit in some forge’s webapp then #789
could be a hyperlink to the pull request. And if the merge commit
message is nothing more than that line then they might need to open the
PR in order to view the description and the discussion.
Squash merges
The pseudo-merge variant “squash” also acts like this since they can be
also written as “Merged ...”, i.e. with the same kind of information.
Rebase as cherry-picks
Arguably cherry-picks are an option on forges that allow you to
incorporate a pull request by way of a rebase + fast-forward.
Not wanting to change incoming commit messages
We’ve already talked about how merge commits can be used to add metadata
to an incorporated branch. In contrast, there is no culture for changing
commit messages in forge-based workflows.
I don’t mean changing the commit message proper but adding or modifying
metadata in the form of trailers.
Some projects, like the Git project, use a patch-based workflow with
signoffs. Which means that both the developer signs off the patch
when they send it out:
Implement X
Signed-off-by: John Smith <[email protected]>
And the integrator as well when they import the patch from their
mailbox:
Implement X
Signed-off-by: John Smith <[email protected]>
Signed-off-by: Jane Underhill <[email protected]>
These trailers are also used for other kinds of metadata about the
review process:
Implement X
Signed-off-by: John Smith <[email protected]>
Tested-by: Hobsbert Fedora <[email protected]>
Acked-by: Frank Wall <[email protected]>
Signed-off-by: Jane Underhill <[email protected]>
In this way, each patch (a future commit) can get their own metadata.
I haven’t seen any culture for this in forge-based (read: PRs)
workflows. But I see no reason why commits can’t be cherry-picked with
metadata about whence the PR:
Implement X
Pull-request: #654
Conclusion and personal opinion
Personally I prefer true merges on my own multi-commit pull requests. On
single-commit PRs I do prefer what is effectively a cherry-pick, since I
use a “squash merge” for those if I’m the one who is incorporating the
change.
But sometimes I want to make a small PR on top of another person’s
PR. For such smaller PRs I think this cherry-pick idea is nice, and that
creating a true merge is often overkill (and distracting). Then a
cherry-pick (or rebase) with some metadata about the provenance of the
change would work great, I think.
Include Y in X as well
Pull-request: #4935
Good question by the way.