git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] merge: --ff-one-only to apply FF if commit is one

From
Kristoffer Haugsbakk <code@khaugsbakk.name>
Date
Oct 25, 2023, 16:27 UTC
Message-ID
<da246287-8530-4680-8fcc-f68f881bc24b@app.fastmail.com>
In-Reply-To
<pull.1599.git.git.1698224280816.gitgitgadget@gmail.com>
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
Previous: Ruslan Yakauleu via GitGitGadgetNext: Ruslan Yakauleu
Message 2 of 15 in “merge: --ff-one-only to apply FF if commit is one”
  1. merge: --ff-one-only to apply FF if commit is oneRuslan Yakauleu via GitGitGadget, Oct 25, 2023
  2. Kristoffer HaugsbakkOct 25, 2023
  3. Ruslan YakauleuOct 25, 2023
  4. Kristoffer HaugsbakkOct 25, 2023
  5. Taylor BlauOct 30, 2023
  6. Junio C HamanoOct 31, 2023
  7. Ruslan YakauleuOct 31, 2023
  8. Junio C HamanoOct 31, 2023
  9. Kristoffer HaugsbakkOct 31, 2023
  10. Junio C HamanoNov 1, 2023
  11. Ruslan YakauleuNov 1, 2023
  12. Kristoffer HaugsbakkNov 1, 2023
  13. Junio C HamanoNov 1, 2023
  14. Ruslan YakauleuOct 31, 2023
  15. Ruslan YakauleuOct 26, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.