From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Andreas Schwab <schwab@linux-m68k.org>,
Peter Krefting <peter@softwolves.pp.se>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH RFC] rebase: add --revisions flag
Date: Fri, 11 Dec 2009 12:07:20 +0100 [thread overview]
Message-ID: <20091211110720.GA19232@atjola.homenet> (raw)
In-Reply-To: <7vpr6mkaoz.fsf@alter.siamese.dyndns.org>
On 2009.12.10 09:20:28 -0800, Junio C Hamano wrote:
> Björn Steinbrink <B.Steinbrink@gmx.de> writes:
>
> >> But at the conceptual level, "merge --squash" is a short-hand for this
> >> command sequence:
> >>
> >> git rebase -i HEAD that-branch
> >> ... make everything except the first one into "squash"
> >> git checkout - ;# come back to the original branch
> >> git merge that-branch ;# fast forward to it
> >>
> >> So after all, it is "merge it after squashing them".
> >
> > To me, that approach looks backwards,...
>
> Yes, of course, but what you are missing (and I am at blame for forgetting
> to mention the history behind this in the message you are responding to)
> is that "merge --squash" to support a particular need/use case was done
> way before "rebase -i" came into existence.
Hm? You started explaining that "merge --squash" would be right because
you can do it via some command sequence that involves rebase -i and then
merge. I said that using that rebase+merge sequence as an argument for
the choice of the name is wrong. It would even have made more sense to
me if you said:
git merge that-branch
git reset --soft HEAD^
git commit -C ORIG_HEAD
Which is "merge, but then drop the extra parents", which pretty close to
what "merge --squash" does (and that sequence even gets it right not to
rewrite that-branch).
I'm not arguing that you shouldn't have chosen "merge --squash" to do
that. You couldn't possibly foresee the future and that git might get
rebase -i or maybe at some day cherry-pick -i <range>. I'm just saying
that in retrospective, it's sad that merge doesn't always mean "merge
histories", but that --squash makes it degenerate to "merge changes".
I don't see why you're trying to defend the choice of "merge --squash"
using a IMHO rather weird command sequence that happens to involve
"merge", using commands that weren't present when "merge --squash" was
added, but at the same ignore the "cherry-pick -i <range>" command git
might learn in the near future, which allows for a much saner
explanation:
git cherry-pick -i ..that-branch
... make everything except the first one into "squash"
And given that, one could add a --squash flag to cherry-pick that makes
it do the "squash everything" itself, allowing it to be a bit smarter
about the whole thing, because it could use a three-way merge
internally, instead of cherry-picking all the individual commits. Making
"git cherry-pick --squash ..that-branch" the same as "git merge --squash
that-branch".
> A nicer workflow may be to use "rebase -i" to clean up the history before
> even contemplating to integrate the topic to the mainline, instead of the
> above "abandoning or forking off again", if you know today's git.
Well, I'm not saying that git should completely lose the abilitiy to do
something like "merge --squash", just that if it learns "git cherry-pick
<range>", it might as well get the --squash thing for cherry-pick, maybe
allowing for "merge --squash" to be phased out. And heck, having it as
an option to cherry-pick instead of merge would probably already help a
lot to make people realise that it won't remember that the changes got
"integrated". We've had people on #git that wondered why repeated "git
merge --squash" commands would try to merge the same stuff over and over
again, leading to the same conflicts every time. Because they didn't
realise that with --squash, "git merge" is no longer about merging
histories.
> But interactive was not available back then. It was introduced at 1b1dce4
> (Teach rebase an interactive mode, 2007-06-25), which is 1 year after
> 7d0c688 (git-merge --squash, 2006-06-23).
Again, I'm not blaming you for having chosen that command back then.
Just saying that it might be better to have the same functionality in an
extended cherry-pick now.
Björn
next prev parent reply other threads:[~2009-12-11 11:07 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-08 14:47 [PATCH RFC] rebase: add --revisions flag Michael S. Tsirkin
2009-12-08 16:08 ` Björn Steinbrink
2009-12-08 16:11 ` Michael S. Tsirkin
2009-12-08 16:41 ` Björn Steinbrink
2009-12-08 16:49 ` Michael S. Tsirkin
2009-12-08 19:13 ` Björn Steinbrink
2009-12-08 16:14 ` Michael S. Tsirkin
2009-12-08 16:37 ` Björn Steinbrink
2009-12-08 16:44 ` Michael S. Tsirkin
2009-12-08 19:11 ` Björn Steinbrink
2009-12-08 20:00 ` Michael S. Tsirkin
2009-12-09 13:19 ` Björn Steinbrink
2009-12-09 14:02 ` Michael S. Tsirkin
2009-12-09 4:51 ` Miles Bader
2009-12-08 20:22 ` Junio C Hamano
2009-12-08 20:29 ` Sverre Rabbelier
2009-12-09 5:30 ` Christian Couder
2009-12-09 6:52 ` Christian Couder
2009-12-09 9:08 ` Sverre Rabbelier
2009-12-09 8:47 ` Peter Krefting
2009-12-09 9:37 ` Michael S. Tsirkin
2009-12-09 10:52 ` Peter Krefting
2009-12-09 11:22 ` Björn Steinbrink
2009-12-09 11:48 ` Andreas Schwab
2009-12-09 12:06 ` Björn Steinbrink
2009-12-09 12:07 ` Michael S. Tsirkin
2009-12-09 13:06 ` Björn Steinbrink
2009-12-09 19:46 ` Junio C Hamano
2009-12-10 7:43 ` Björn Steinbrink
2009-12-10 17:20 ` Junio C Hamano
2009-12-11 11:07 ` Björn Steinbrink [this message]
2009-12-09 13:20 ` Peter Krefting
2009-12-09 13:41 ` Björn Steinbrink
2009-12-10 8:43 ` Peter Krefting
2009-12-10 11:08 ` Björn Steinbrink
2009-12-09 10:38 ` Michael S. Tsirkin
2009-12-09 10:55 ` Matthieu Moy
2009-12-09 13:30 ` Matthieu Moy
2009-12-09 13:45 ` Michael S. Tsirkin
2009-12-09 14:01 ` Björn Steinbrink
2009-12-09 14:12 ` Michael S. Tsirkin
2009-12-09 20:10 ` Junio C Hamano
2009-12-13 22:47 ` David Kågedal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091211110720.GA19232@atjola.homenet \
--to=b.steinbrink@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mst@redhat.com \
--cc=peter@softwolves.pp.se \
--cc=schwab@linux-m68k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox