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

Why "You cannot combine --squash with --no-ff" in git merge?

From
Anatoly Borodin <anatoly.borodin@gmail.com>
Date
Mar 21, 2017, 01:57 UTC
Message-ID
<oaq19p$kpo$1@blaine.gmane.org>
Hi All,

the message "You cannot combine --squash with --no-ff" appeared in 2008, in the commit 1c7b76be7d620bbaf2e6b8417f04012326bbb9df ("Build in merge"). I don't understand the logic of this restriction.

Imagine, I have the following branches, where A is a master and B is a feature branch:

	A---B1---B2---B3---B4---B
`git checkout A && git merge --squash --no-ff B` says:
	fatal: You cannot combine --squash with --no-ff.
`git merge --squash --ff` will happily move the A ref to the B commit.
But what I want, and expect, is:
	A---B'
where B' has the same tree as B.

This can of course be done with `git rebase --interactive` and marking all commits for squash or fixup. But `git merge --squash` works with not-fastforwarding feature branch, why should it refuse to work in a fastforwarding case?

-- 
Mit freundlichen Grüßen,
Anatoly Borodin
Next: Anatoly Borodin
Message 1 of 2 in “Why "You cannot combine --squash with --no-ff" in git merge?”
  1. Anatoly BorodinMar 21, 2017
  2. Anatoly BorodinMar 21, 2017

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.