{"thread":{"id":"38057","subject":"Why does git merge --squash fail when merge.ff is set to only?","startedAt":"2014-11-26T19:42:57Z","lastAt":"2014-11-26T21:32:35Z","messageCount":2,"participants":["Paul Smith","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"252596","messageId":"1417030977.23650.42.camel@homebase","threadId":"38057","inReplyTo":null,"subject":"Why does git merge --squash fail when merge.ff is set to only?","fromName":"Paul Smith","fromEmail":"paul@mad-scientist.net","sentAt":"2014-11-26T19:42:57Z","receivedAt":"2014-11-26T19:42:57Z","isPatch":false,"sender":{"key":"paul@mad-scientist.net","avatar":"https://avatars.githubusercontent.com/u/109636?v=4"},"body":"In our development process we always want to do rebase and only rarely\ncreate merge commits, and so we have a recommendation to set the\nmerge.ff configuration attribute to \"only\".\n\nThis is great, however it appears to break git merge --squash (which we\nalso use constantly).\n\nIf I'm squash-merging from a branch which is not based on HEAD (cannot\nuse fast-forwarding) then I get the extremely cryptic error:\n\n  $ git checkout master\n  $ git pull\n  $ git merge --squash my-branch\n  fatal: Not possible to fast-forward, aborting.\n\nI couldn't even understand what this error meant for a while: what was\nbeing fast-forwarded here anyway?  It took me a lot of thought to\nrealize it was related to the merge.ff config setting.\n\nEventually I figured it out, and now have this workaround:\n\n  $ git merge --ff --squash my-branch\n\nBut, shouldn't we consider this a bug?  I don't see any reason why\n--squash should pay attention to the ff config setting, or command line\nflags either for that matter.  IMHO when you add the --squash flag, the\nff options/config should be ignored.\n\nOr, am I missing some subtle issue here?\n"},{"id":"252607","messageId":"xmqqh9xlps0c.fsf@gitster.dls.corp.google.com","threadId":"38057","inReplyTo":"1417030977.23650.42.camel@homebase","subject":"Re: Why does git merge --squash fail when merge.ff is set to only?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-11-26T21:32:35Z","receivedAt":"2014-11-26T21:32:35Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paul Smith <paul@mad-scientist.net> writes:\n\n> In our development process we always want to do rebase and only rarely\n> create merge commits, and so we have a recommendation to set the\n> merge.ff configuration attribute to \"only\".\n>\n> This is great, however it appears to break git merge --squash (which we\n> also use constantly).\n>\n> If I'm squash-merging from a branch which is not based on HEAD (cannot\n> use fast-forwarding) then I get the extremely cryptic error:\n>\n>   $ git checkout master\n>   $ git pull\n>   $ git merge --squash my-branch\n>   fatal: Not possible to fast-forward, aborting.\n>\n> I couldn't even understand what this error meant for a while: what was\n> being fast-forwarded here anyway?  It took me a lot of thought to\n> realize it was related to the merge.ff config setting.\n>\n> Eventually I figured it out, and now have this workaround:\n>\n>   $ git merge --ff --squash my-branch\n>\n> But, shouldn't we consider this a bug?  I don't see any reason why\n> --squash should pay attention to the ff config setting, or command line\n> flags either for that matter.  IMHO when you add the --squash flag, the\n> ff options/config should be ignored.\n>\n> Or, am I missing some subtle issue here?\n\nOffhand I do not think of any, but I do not use --ff-only or quash\nmerge myself very often.  If I have to guess, this is merely an\nimplementation glitch where whoever did \"merge --squash\" did not\nthink its interaction with --ff-only through (if --ff-only came\nfirst) or whoever did \"merge.ff = only\" support did not think its\ninteraction with \"merge --squash\" through (if things happened in the\nother order).\n"}]}