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

Re: [RFC PATCH] Make the rebase edit mode really end up in an edit state

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 16, 2009, 01:09 UTC
Message-ID
<7v3afkqcnt.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20090115225912.GL9794@neumann>
SZEDER Gábor <szeder@ira.uka.de> writes:
Show 6 quoted lines
> But the current behaviour of the 'edit' rebase command gives you the
> possibility of adding further commits on top of the selected one
> (after you have edited that or left intact, doesn't matter).  To do
> that with this automatic 'reset --soft HEAD^' modification you would
> first need to 'git commit -c @{1}' to keep the selected commit before
> going on with adding further commits, which is not quite nice.
Yeah, I agree.

I think my confusion mostly came from perception, and the way the "edit" action is (not) explained.

What "edit" means is "pick this commit and then stop to give control back to the user. The user is free to muck with the history starting from the state after picking the named commit in any way, and --continue will carry on the rest of the insns from the state" [*1*]. Once I realize that, it becomes clear what it means to do any of the following when "edit" gives the control back to me:

 (1) commit --amend (with or without changing the tree and message); this
     is the originally intended usage.  Edit the commit the machinery just
     picked and let it continue.  The end result is as if you edited one
     commit in the sequence.
 (2) making completely unrelated commits on top of the state "edit" gave
     you; this inserts a new commit in the sequence.
 (3) first "reset HEAD^", commit selected parts of the difference in one
     commit, commit the reaminder in another commit; this splits the
     commit the machinery just picked into two.

By the way, "rebase --continue" codepath has extra code that does something magical when the index does not match the HEAD commit. I suspect what it does makes sense only in the originally intended usage sequence (i.e. "edit" stops, you want to do "commit --amend" and then "rebase --continue" but somehow you forgot to commit everything).

How well does that logic work when the user wanted to do (2) or (3) above, and happened to have the index unclean when s/he said "rebase --continue"? Does it do something nonsensical?

[Footnote]

*1* Explained the same way, "pick" is "cherry-pick the named commit to replay its effect and then continue".

Previous: Anders MelchiorsenNext: Johannes Schindelin
Message 15 of 55 in “Make the rebase edit mode really end up in an edit state”
  1. Make the rebase edit mode really end up in an edit stateAnders Melchiorsen, Jan 15, 2009
  2. Junio C HamanoJan 15, 2009
  3. Boyd Stephen Smith Jr.Jan 15, 2009
  4. Miles BaderJan 15, 2009
  5. Boyd Stephen Smith Jr.Jan 15, 2009
  6. Junio C HamanoJan 15, 2009
  7. Johannes SchindelinJan 15, 2009
  8. SZEDER GáborJan 15, 2009
  9. Junio C HamanoJan 15, 2009
  10. Sverre RabbelierJan 15, 2009
  11. SZEDER GáborJan 15, 2009
  12. Björn SteinbrinkJan 16, 2009
  13. Johannes SchindelinJan 16, 2009
  14. Anders MelchiorsenJan 18, 2009
  15. Junio C HamanoJan 16, 2009
  16. Johannes SchindelinJan 16, 2009
  17. Stephan BeyerJan 15, 2009
  18. Johannes SchindelinJan 15, 2009
  19. Johannes SixtJan 15, 2009
  20. Johan HerlandJan 15, 2009
  21. Sverre RabbelierJan 15, 2009
  22. Johannes SchindelinJan 15, 2009
  23. Adeodato SimóJan 15, 2009
  24. Johannes SchindelinJan 15, 2009
  25. Sverre RabbelierJan 15, 2009
  26. Stephan BeyerJan 15, 2009
  27. Johannes SchindelinJan 15, 2009
  28. Adeodato SimóJan 15, 2009
  29. Sverre RabbelierJan 15, 2009
  30. Johannes SchindelinJan 15, 2009
  31. Sverre RabbelierJan 15, 2009
  32. Junio C HamanoJan 15, 2009
  33. Sverre RabbelierJan 15, 2009
  34. Johannes SchindelinJan 15, 2009
  35. Johan HerlandJan 15, 2009
  36. Anders MelchiorsenJan 15, 2009
  37. Johannes SchindelinJan 15, 2009
  38. Wincent ColaiutaJan 15, 2009
  39. Jay SoffianJan 15, 2009
  40. Wincent ColaiutaJan 15, 2009
  41. Johan HerlandJan 16, 2009
  42. Anders MelchiorsenJan 16, 2009
  43. Johan HerlandJan 16, 2009
  44. SZEDER GáborJan 16, 2009
  45. Johannes SchindelinJan 16, 2009
  46. SZEDER GáborJan 16, 2009
  47. Wincent ColaiutaJan 16, 2009
  48. Sverre RabbelierJan 16, 2009
  49. Stephan BeyerJan 16, 2009
  50. Johannes SchindelinJan 16, 2009
  51. Pieter de BieJan 15, 2009
  52. Sverre RabbelierJan 15, 2009
  53. Pieter de BieJan 15, 2009
  54. Björn SteinbrinkJan 15, 2009
  55. Johan HerlandJan 15, 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.