git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Why does git merge --squash fail when merge.ff is set to only?
@ 2014-11-26 19:42 Paul Smith
  2014-11-26 21:32 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Smith @ 2014-11-26 19:42 UTC (permalink / raw)
  To: git

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?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Why does git merge --squash fail when merge.ff is set to only?
  2014-11-26 19:42 Why does git merge --squash fail when merge.ff is set to only? Paul Smith
@ 2014-11-26 21:32 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2014-11-26 21:32 UTC (permalink / raw)
  To: paul; +Cc: git

Paul Smith <paul@mad-scientist.net> writes:

> 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?

Offhand I do not think of any, but I do not use --ff-only or quash
merge myself very often.  If I have to guess, this is merely an
implementation glitch where whoever did "merge --squash" did not
think its interaction with --ff-only through (if --ff-only came
first) or whoever did "merge.ff = only" support did not think its
interaction with "merge --squash" through (if things happened in the
other order).

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-26 21:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-26 19:42 Why does git merge --squash fail when merge.ff is set to only? Paul Smith
2014-11-26 21:32 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).