Re: [PATCH] merge: --ff-one-only to apply FF if commit is one
From: Kristoffer Haugsbakk <hidden>
Date: 2023-10-25 16:27:27
Hi On Wed, Oct 25, 2023, at 10:58, Ruslan Yakauleu via GitGitGadget wrote:
A new option --ff-one-only to control the merging strategy. For one commit option works like -ff to avoid extra merge commit. In other cases the option works like --no-ff to create merge commit for complex features.
I do something similar for my pull requests:
- If more than one commit: `--no-ff`
- One commit: rebase/squash
Your change would (according to the commit message) only *not* create a
merge if it so happens to be the case that you can fast-forward the
branch. So it would create a merge commit if (say) your branch was three
commits behind and one ahead (your commit) of the target branch. But isn’t
it fine to just rebase/squash in this case? That seems more general.
(Maybe `--squash-one-only`.)
But it seems that your new option would work nicely with “semi-linear”
merges:[1]
- Rebase on the target branch
- `--ff-one-only`
- Now you either get:
- a “semi-linear merge”; or
- a single commit (as opposed to a merge which joins together a branch
which is 0 behind and 1 ahead of the target branch)
--
Kristoffer