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

4 messages, 3 authors, 2016-06-15 · open the first message on its own page

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

From: Andreas Schwab <hidden>
Date: 2016-06-15 22:47:51

Björn Steinbrink [off-list ref] 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"?

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

From: Björn Steinbrink <hidden>
Date: 2016-06-15 22:47:51

On 2009.12.09 12:48:24 +0100, Andreas Schwab wrote:
Björn Steinbrink [off-list ref] writes:
quoted
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.

Björn

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

From: "Michael S. Tsirkin" <mst@redhat.com>
Date: 2016-06-15 22:47:51

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:
quoted
Björn Steinbrink [off-list ref] writes:
quoted
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.

Björn
So this will be best written as
git cherry-pick ..foo

-- 
MST

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

From: Björn Steinbrink <hidden>
Date: 2016-06-15 22:47:51

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:
quoted
On 2009.12.09 12:48:24 +0100, Andreas Schwab wrote:
quoted
Björn Steinbrink [off-list ref] writes:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help