{"thread":{"id":"45451","subject":"Why \"You cannot combine --squash with --no-ff\" in git merge?","startedAt":"2017-03-21T01:57:38Z","lastAt":"2017-03-21T02:12:28Z","messageCount":2,"participants":["Anatoly Borodin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"314770","messageId":"oaq19p$kpo$1@blaine.gmane.org","threadId":"45451","inReplyTo":null,"subject":"Why \"You cannot combine --squash with --no-ff\" in git merge?","fromName":"Anatoly Borodin","fromEmail":"anatoly.borodin@gmail.com","sentAt":"2017-03-21T01:57:13Z","receivedAt":"2017-03-21T01:57:38Z","isPatch":false,"sender":{"key":"anatoly.borodin@gmail.com","avatar":"https://gravatar.com/avatar/59f11f1f45cf5ebb7bcca8da94b43cfe5f596d91c0a3e27ad0d2a861cc2bbce7?d=mp&s=160"},"body":"Hi All,\n\nthe message \"You cannot combine --squash with --no-ff\" appeared in 2008,\nin the commit 1c7b76be7d620bbaf2e6b8417f04012326bbb9df (\"Build in\nmerge\"). I don't understand the logic of this restriction.\n\nImagine, I have the following branches, where A is a master and B is a\nfeature branch:\n\n\tA---B1---B2---B3---B4---B\n\n`git checkout A && git merge --squash --no-ff B` says:\n\n\tfatal: You cannot combine --squash with --no-ff.\n\n`git merge --squash --ff` will happily move the A ref to the B commit.\n\nBut what I want, and expect, is:\n\n\tA---B'\n\nwhere B' has the same tree as B.\n\nThis can of course be done with `git rebase --interactive` and marking\nall commits for squash or fixup. But `git merge --squash` works with\nnot-fastforwarding feature branch, why should it refuse to work in a\nfastforwarding case?\n\n-- \nMit freundlichen Grüßen,\nAnatoly Borodin\n\n"},{"id":"314774","messageId":"oaq256$u33$1@blaine.gmane.org","threadId":"45451","inReplyTo":"oaq19p$kpo$1@blaine.gmane.org","subject":"Re: Why \"You cannot combine --squash with --no-ff\" in git merge?","fromName":"Anatoly Borodin","fromEmail":"anatoly.borodin@gmail.com","sentAt":"2017-03-21T02:11:50Z","receivedAt":"2017-03-21T02:12:28Z","isPatch":false,"sender":{"key":"anatoly.borodin@gmail.com","avatar":"https://gravatar.com/avatar/59f11f1f45cf5ebb7bcca8da94b43cfe5f596d91c0a3e27ad0d2a861cc2bbce7?d=mp&s=160"},"body":"Hi All,\n\n\nI made a mistake in the previous message. I'm really sorry, I need to go\nhave some sleep right now.\n\nAnatoly Borodin <anatoly.borodin@gmail.com> wrote:\n> `git merge --squash --ff` will happily move the A ref to the B commit.\n> \n> But what I want, and expect, is:\n> \n>         A---B'\n> \n> where B' has the same tree as B.\n\n`git merge --squash --ff` WILL create A---B'.\n\nBut it's still unclear to me why `git merge --squash --no-ff` should\nfail instead of doing the same as `git merge --squash --ff` does. The\nerror message and the documentation do not give any good reasons for it.\n\nPS In my case, I set `merge.ff=false` and run just `git merge --squash`.\n\n\n-- \nMit freundlichen Grüßen,\nAnatoly Borodin\n\n"}]}