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

Why does git merge --squash fail when merge.ff is set to only?

From
Paul Smith <paul@mad-scientist.net>
Date
Nov 26, 2014, 19:42 UTC
Message-ID
<1417030977.23650.42.camel@homebase>

In our development process we always want to do rebase and only rarely create merge commits, and so we have a recommendation to set the merge.ff configuration attribute to "only".

This is great, however it appears to break git merge --squash (which we also use constantly).

If I'm squash-merging from a branch which is not based on HEAD (cannot use fast-forwarding) then I get the extremely cryptic error:

  $ git checkout master
  $ git pull
  $ git merge --squash my-branch
  fatal: Not possible to fast-forward, aborting.

I couldn't even understand what this error meant for a while: what was being fast-forwarded here anyway? It took me a lot of thought to realize it was related to the merge.ff config setting.

Eventually I figured it out, and now have this workaround:
  $ git merge --ff --squash my-branch

But, shouldn't we consider this a bug? I don't see any reason why --squash should pay attention to the ff config setting, or command line flags either for that matter. IMHO when you add the --squash flag, the ff options/config should be ignored.

Or, am I missing some subtle issue here?
Next: Junio C Hamano
Message 1 of 2 in “Why does git merge --squash fail when merge.ff is set to only?”
  1. Paul SmithNov 26, 2014
  2. Junio C HamanoNov 26, 2014

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.