git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
* Why "You cannot combine --squash with --no-ff" in git merge?
@ 2017-03-21  1:57 Anatoly Borodin
  2017-03-21  2:11 ` Anatoly Borodin
  0 siblings, 1 reply; 2+ messages in thread
From: Anatoly Borodin @ 2017-03-21  1:57 UTC (permalink / raw)
  To: git

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


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

* Re: Why "You cannot combine --squash with --no-ff" in git merge?
  2017-03-21  1:57 Why "You cannot combine --squash with --no-ff" in git merge? Anatoly Borodin
@ 2017-03-21  2:11 ` Anatoly Borodin
  0 siblings, 0 replies; 2+ messages in thread
From: Anatoly Borodin @ 2017-03-21  2:11 UTC (permalink / raw)
  To: git

Hi All,


I made a mistake in the previous message. I'm really sorry, I need to go
have some sleep right now.

Anatoly Borodin <anatoly.borodin@gmail.com> wrote:
> `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.

`git merge --squash --ff` WILL create A---B'.

But it's still unclear to me why `git merge --squash --no-ff` should
fail instead of doing the same as `git merge --squash --ff` does. The
error message and the documentation do not give any good reasons for it.

PS In my case, I set `merge.ff=false` and run just `git merge --squash`.


-- 
Mit freundlichen Grüßen,
Anatoly Borodin


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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-21  1:57 Why "You cannot combine --squash with --no-ff" in git merge? Anatoly Borodin
2017-03-21  2:11 ` Anatoly Borodin

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox