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

Re: Can't squash merge with merge.ff set to false

From
Bryan Turner <bturner@atlassian.com>
Date
Jan 5, 2018, 20:12 UTC
Message-ID
<CAGyf7-FHyO9pkEFFguea+B+VMTodF=mg8wJNedvjYdL7e7ORqQ@mail.gmail.com>
In-Reply-To
<CAHd499C=3Y-ykgYZhSJzk=e-Pi6BUFeN8C89krd5T7T5fRB91g@mail.gmail.com>
On Fri, Jan 5, 2018 at 11:59 AM, Robert Dailey <rcdailey.lists@gmail.com> wrote:
Show 19 quoted lines
> Not sure if this is intended or a bug, but with the following configuration:
>
> $ git config --global merge.ff false
>
> I am not able to merge my topic branch into master with squash option:
>
> $ git checkout master
> $ git merge --squash topic
> fatal: You cannot combine --squash with --no-ff.
>
> I'm not sure why a non-fast-forward merge would prevent a squash
> merge, since by its very nature a squashed merge is not a fast forward
> merge (or maybe it is if you only have one commit).
>
> Is there an issue here? I like fast forward merges to be off by
> default, since I want to control when they happen. Most of my merges
> do not use --squash, so I'm catering to the common case.
>
> Need advice on how to get past this issue. Thanks in advance.

The easiest way to move forward is probably to pass "--ff" on the command line to override the config, when you're using "--squash".

As for why the two aren't allowed together, my assumption would be because if you're only squashing a single commit "--squash" and that commit is fast-forward from the target, a new commit is not created and instead the target branch is fast-forwarded. With "--no-ff", it's questionable what "--squash" should do in that case. Fast-forward anyway? Rewrite the commit simply to get new committer details and SHA-1?

Hope this helps! Bryan Turner

Previous: Robert DaileyNext: Paul Smith
Message 2 of 7 in “Can't squash merge with merge.ff set to false”
  1. Robert DaileyJan 5, 2018
  2. Bryan TurnerJan 5, 2018
  3. Paul SmithJan 5, 2018
  4. Robert DaileyJan 5, 2018
  5. Bryan TurnerJan 5, 2018
  6. Robert DaileyJan 5, 2018
  7. Jonathan NiederJan 6, 2018

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.