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

Re: An alternate model for preparing partial commits

From
DJDavid Jeske <jeske@willowmail.com>
Date
Aug 13, 2016, 23:23 UTC
Message-ID
<willow-jeske-01l83mS5FEDjCcUW>
In-Reply-To
<9af502e50806281125v5459f7deuc14256044b3e726@mail.gmail.com>
-- Robert Anderson wrote:
> If I come back to a branch on which there are several
> commits which have not been pushed yet, how do I know which are
> "temporary" and which are "for real" commits?  I cannot.  It is
> impossible.  The information is not there.

This comment resonates with me Robert. Because git's concept of a workspace is a "non-tracking branch", git doesn't automate having "temporary" and "for real" commits intermixed in the workspace, or having more than one "named set of temporary commits".

Imagine if we use git's mechanisms to setup a "p4 change" style workflow. In that workflow, we can have multiple outstanding named changes in the same working-files. This seems simple and reasonable to me, I use it quite a bit in p4. My most common use of it is to prevent myself from accidentally publishing a set of edited files that are supposed to remain local as I'm iterating (I throw them in a "don't submit this yet" pending change).

If we dynamically compose a "workspace" out of 2 temporary "changes" it might look like this:

: /---PQ workspace/1 : |<- Q / change/feature1 : |<---- P change/feature2 : | : --A<--B master

You're working in workspace 1, and you could pretty easily make the equivilant of "git commit -c change/feature2". That would say, "hey, commit this change, and then merge it down to "change/feature2 branch" as R'.

: /---PQ---R workspace/1 : |<- Q / / change/feature1 : |<---- P<---R' change/feature2 : | : --A<--B master

This seems doable, and git's mechanisms would make it pretty easy (though it feels dangerous to me).

You can then merge either change onto the master when it's done. Your little wrapper could give you a "workspace rebase" which could destroy the workspace, rebase all the features, and recompose the workspace. If you want to rebase one of the changes onto the master, again, your wrapper destroys the workspace, rebases and pushes the change, rebases the rest of the changes, and recreates your workspace.

All of that "destroying the workspace" is required because rebase is a change operation which does not contain merge-history. In the setup above, your "change/*" branches are effectively "published to your workspace", so if you rebase either of them, you're technically rebasing something that's published, and "workspace" will be in a world of hurt. Therefore, one solution is to destroy the workspace, making the rebase a valid operation, then recompose it. Personally, I'd like to see rebase made to have merge history, using some kind of "soft-dag-link" that would cause it to work for anyone who had those changes, while not causing the history to show or hold onto those parents.

Previous: David JeskeNext: Stephen Sinclair
Message 50 of 57 in “An alternate model for preparing partial commits”
  1. Robert AndersonJun 27, 2008
  2. Björn SteinbrinkJun 27, 2008
  3. stash: introduce 'stash save --keep-index' optionSZEDER Gábor, Jun 27, 2008
  4. Junio C HamanoJun 27, 2008
  5. Robert AndersonJun 27, 2008
  6. Björn SteinbrinkJun 27, 2008
  7. Robert AndersonJun 27, 2008
  8. Johannes SixtJun 27, 2008
  9. Robert AndersonJun 27, 2008
  10. Petr BaudisJun 27, 2008
  11. Robert AndersonJun 27, 2008
  12. Johannes SchindelinJun 27, 2008
  13. Miklos VajnaJun 27, 2008
  14. Robert AndersonJun 27, 2008
  15. Johannes SchindelinJun 27, 2008
  16. Robert AndersonJun 27, 2008
  17. Dana HowJun 27, 2008
  18. Stephen SinclairJun 27, 2008
  19. David JeskeJun 27, 2008
  20. David JeskeAug 13, 2016
  21. Wincent ColaiutaJun 28, 2008
  22. Dmitry PotapovJun 28, 2008
  23. Robert AndersonJun 28, 2008
  24. Dmitry PotapovJun 28, 2008
  25. Junio C HamanoJun 27, 2008
  26. Robert AndersonJun 27, 2008
  27. Jeff KingJun 28, 2008
  28. Robert AndersonJun 28, 2008
  29. Jeff KingJun 28, 2008
  30. Junio C HamanoJun 28, 2008
  31. Johannes SchindelinJun 28, 2008
  32. Jeff KingJul 8, 2008
  33. David JeskeJun 27, 2008
  34. Jakub NarebskiJun 27, 2008
  35. David JeskeJun 27, 2008
  36. David JeskeAug 13, 2016
  37. David JeskeAug 13, 2016
  38. Robert AndersonJun 27, 2008
  39. Robert AndersonJun 27, 2008
  40. Junio C HamanoJun 27, 2008
  41. Robert AndersonJun 28, 2008
  42. Dmitry PotapovJun 28, 2008
  43. Robert AndersonJun 28, 2008
  44. Stephen SinclairJun 28, 2008
  45. Robert AndersonJun 28, 2008
  46. Robert AndersonJun 28, 2008
  47. Jakub NarebskiJun 28, 2008
  48. Robert AndersonJun 28, 2008
  49. David JeskeJun 28, 2008
  50. David JeskeAug 13, 2016
  51. Stephen SinclairJun 28, 2008
  52. David JeskeJun 28, 2008
  53. David JeskeAug 13, 2016
  54. Fwd: An alternate model for preparing partial commitsRobert Anderson, Jun 28, 2008
  55. Dmitry PotapovJun 28, 2008
  56. Robert AndersonJun 28, 2008
  57. Dmitry PotapovJun 28, 2008

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.