git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Björn Steinbrink <b.steinbrink@gmx.de>
Date
Dec 9, 2009, 13:41 UTC
Message-ID
<20091209134133.GA30596@atjola.homenet>
In-Reply-To
<alpine.DEB.2.00.0912091414460.470@ds9.cixit.se>
On 2009.12.09 14:20:23 +0100, Peter Krefting wrote:
Show 16 quoted lines
> Björn Steinbrink:
> 
> >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.
> 
> Exactly!
> 
> What I meant to say in the original message was that conceptually,
> the difference between a "git rebase --reverse A..B", a "git
> cherry-pick A..B" and a "git merge --squash A..B" is minute.
> 
> And when continuing the thought experiment, the step from "git merge
> --squash A..B" to "git merge A..B" is not very large either, just (a
> lot) more difficult to implement.

"git merge" is about merging histories. --squash and the A..B you suggest make it degenerate into merging changes (and you can't record that using the commit DAG). So that messes things up conceptually.

Implementing probably wouldn't be that hard, IIRC it should be a matter of messing with the fake merge base that cherry-pick uses to get its job done. While "git cherry-pick foo" uses foo^ as the merge base, you'd just make "git merge --squash A..B" work like "git cherry-pick B" but use A as the fake merge base. It's been a while since I looked at the cherry-pick code though, so I might be off here.

(Kind of ironic though that I didn't think of that when I said that "cherry-pick --squash" would be hard to do...)

Anyway, "git merge" with a range simply makes no sense at all given how git's merge works (opposed to svn's idea of merging, which is about changes, not about histories). If you want a squash flag, tell cherry-pick to handle ranges and teach such a flag to it.

Björn
Previous: Peter KreftingNext: Peter Krefting
Message 33 of 43 in “rebase: add --revisions flag”
  1. rebase: add --revisions flagMichael S. Tsirkin, Dec 8, 2009
  2. Björn SteinbrinkDec 8, 2009
  3. Michael S. TsirkinDec 8, 2009
  4. Björn SteinbrinkDec 8, 2009
  5. Michael S. TsirkinDec 8, 2009
  6. Björn SteinbrinkDec 8, 2009
  7. Michael S. TsirkinDec 8, 2009
  8. Björn SteinbrinkDec 8, 2009
  9. Michael S. TsirkinDec 8, 2009
  10. Björn SteinbrinkDec 8, 2009
  11. Michael S. TsirkinDec 8, 2009
  12. Björn SteinbrinkDec 9, 2009
  13. Michael S. TsirkinDec 9, 2009
  14. Miles BaderDec 9, 2009
  15. Junio C HamanoDec 8, 2009
  16. Sverre RabbelierDec 8, 2009
  17. Christian CouderDec 9, 2009
  18. Christian CouderDec 9, 2009
  19. Sverre RabbelierDec 9, 2009
  20. Peter KreftingDec 9, 2009
  21. Michael S. TsirkinDec 9, 2009
  22. Peter KreftingDec 9, 2009
  23. Björn SteinbrinkDec 9, 2009
  24. Andreas SchwabDec 9, 2009
  25. Björn SteinbrinkDec 9, 2009
  26. Michael S. TsirkinDec 9, 2009
  27. Björn SteinbrinkDec 9, 2009
  28. Junio C HamanoDec 9, 2009
  29. Björn SteinbrinkDec 10, 2009
  30. Junio C HamanoDec 10, 2009
  31. Björn SteinbrinkDec 11, 2009
  32. Peter KreftingDec 9, 2009
  33. Björn SteinbrinkDec 9, 2009
  34. Peter KreftingDec 10, 2009
  35. Björn SteinbrinkDec 10, 2009
  36. Michael S. TsirkinDec 9, 2009
  37. Matthieu MoyDec 9, 2009
  38. Matthieu MoyDec 9, 2009
  39. Michael S. TsirkinDec 9, 2009
  40. Björn SteinbrinkDec 9, 2009
  41. Michael S. TsirkinDec 9, 2009
  42. Junio C HamanoDec 9, 2009
  43. David KågedalDec 13, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.