|
|
|
|
|
by lloeki
1065 days ago
|
|
> Because commits have exactly one parent commit This is not true, merge commits are commits with > 1 parents (octopus merges are merely commits with > 2 parents) But indeed since the parents commits are part of the computation of a commit's sha then by design changing the parents means changing the commit's sha, which is a very nice property to have. That said, the model has what we said as a design consequence, but it's perfectly workable to have tooling that walks history and finds branching points and whatnot. Git does it all the time with existing porcelain commands, and I've done it in different contexts (e.g to produce diffs between tip and branching point, analysing which files have changed, and take action pertaining only to these file changes and their dependents) but the gist of it is the same. It's merely a matter of such porcelain commands not being implemented and not being part of upstream git, so everyone either does it manually or invents their own tooling when they're sick of the pain point. |
|
But this did make me realize that the problem with this workflow isn't the "one parent" part at all, it's really just the "immutable parent" part.
But to the main thrust of your comment: Yes, this "porcelain" is what I meant by my surprise that there aren't better tools for this. I think the reason there aren't is that it is really hard to do this well with porcelain, because of requiring a bundle of modifications to the commit tree, where there is no good way to make the whole bundle atomic. So it works fine (and I have a script for it) in the happy path, but it becomes a bit of a nightmare if something doesn't apply quite right.
And that's what I mean by this being unsupported at the data model level, that there is no way to do atomic operations on subtrees as a whole.