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

Re: An alternate model for preparing partial commits

From
Wincent Colaiuta <win@wincent.com>
Date
Jun 28, 2008, 17:23 UTC
Message-ID
<7E75E8FC-FC46-49BC-9610-7F62A3623576@wincent.com>
In-Reply-To
<willow-jeske-01l7ZyqpFEDjC=91ms>
El 27/6/2008, a las 22:45, David Jeske escribió:
Show 5 quoted lines
> - I could supercede 2-commits with 1, effectively making the bad- 
> commit
> disappear in the linear history. Users who already have the history,  
> however,
> would be unaffected, because the start/end endpoints are the same.

You can't do that. The start might be the same but the end point would not, even if the file contents happened to be the same as they were before. This is because each commit is identified by its SHA-1 hash, and changing any ancestor anywhere in the DAG will have a trickle-down effect to all subsequent commits which stem from it, changing their SHA-1 hashes too. So you wind up with a different end point. This is by design (see below).

El 27/6/2008, a las 22:51, David Jeske escribió:
Show 9 quoted lines
> What git can't do, is let me "supercede" the old DAG-subset, so  
> people I shared
> them with can get my new changes without hurting their world.  
> Currently git
> seems to rely on the idea that "if you accept changes into your tree  
> that will
> be later rebased, it's up to you to figure it out". I don't see why  
> that is the
> case.

It has to be this way because it is the only way to do distributed SCM. Imagine for a minute that one developer has a commit "feedface", fetched from another repo. If the commit or any parent (grand parent, great grandparent etc) is changed then the hash _has_ to be different. Otherwise you would have the untenable situation that two developers, two repos, could refer to a particular commit "feedface" and it wouldn't actually be the same thing. Distributed development would be unworkably flakey if you couldn't rely on the stability of each commit's SHA-1 hash, and that fact that it embodies not just that particular state in the history, but all prior states too.

It's a totally basic, fundamental, central, non-negotiable concept to Git's design. And not just an idiosyncrasy either; if you do a review of other distributed SCMs out there you'll find that _all_ of them have a similar underlying precept, as it's literally the only way to do working distributed SCM.

Wincent
Previous: David JeskeNext: Dmitry Potapov
Message 21 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.