Re: [PATCH RFC] rebase: add --revisions flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2009.12.09 14:07:48 +0200, Michael S. Tsirkin wrote:
> On Wed, Dec 09, 2009 at 01:06:10PM +0100, Björn Steinbrink wrote:
> > On 2009.12.09 12:48:24 +0100, Andreas Schwab wrote:
> > > Björn Steinbrink <B.Steinbrink@xxxxxx> writes:
> > > 
> > > > Err, no. "git merge --squash foo" merges all changes from the merge base
> > > > of HEAD and foo up to foo. "git cherry-pick foo" takes just the changes
> > > > from foo^ to foo. For example:
> > > >
> > > > A---B---C (master)
> > > >  \
> > > >   D---E---F (foo)
> > > >
> > > > git cherry-pick foo # Tries to create a new commit with the changes from
> > > >                     # "git diff D F"
> > > 
> > > Did you mean "git diff E F"?
> > 
> > Ugh, yes, of course. Thanks.
> 
> So this will be best written as
> git cherry-pick ..foo

No, "git cherry-pick ..foo" should pick the individual commits, and not
create a single big commit like "git merge --squash". So such a command
should make you end up with:

A---B---C---D'--E'--F' (master)
         \
          D---E---F

Not:
A---B---C---M (master)
         \
          D---E---F (foo)

[M being the "sqash-merge"]

"merge --squash" is one of the things I really dislike, because it turns
off the "history" part of the merge. You can say "Merging in git is about
histories, merging in svn is about changes only" to describe the major
difference for the merge commands in the two systems... "But then
there's --squash which turns git into svn".

I think a "cherry-pick --squash <range>" command would be nicer from a
conceptual point of view, but it's way too late for merge --squash to be
dropped. And I guess it wouldn't be trivial to add such a flag, and not
worth the effort, as you could as well use the interactive mode and
replace "pick" with "squash" manually. (An el cheapo implementation that
automatically replaces it would likely confuse the user, because he
asked for a single commit, but might get to fix conflicts for all the
individual commits).

Björn
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]