-
Notifications
You must be signed in to change notification settings - Fork 372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a jj parallelize
command
#1079
Comments
I often do this as I'm not sure Finally, this is a bit of a distraction, but the inverse operation to this "parallelize" it's tricky, especially if the merge commit resolves a conflict. |
Yes, for parallelizing three commits, you have to do something like
I'm not sure either, but note that the command will hopefully learn to accept many
How so? It seems very similar to how you might get conflicts in C' in the example above. |
I'm having a hard time understanding For example, let's assume we have the following starting point:
How would we get (cli-syntax-wise) to
or even to
? |
I had imagined |
Agreed, that's very close to what I was thinking, and more important than whether we keep it as part of (While I was writing this, you posted a comment that implies I misunderstood what parallelize is about. So, I guess the answer is yes)
Let's say you have two parallel branches with several commits each that merge, and the merge resolves conflicts. Then, you want to stack the branches, so you rebase one on top of the tip of the other. The conflicts are now smeared out across the various commits of the branch that's now on top. It's often easier to resolve them again than to reuse the resolutions you already made in the merge commit. Perhaps a way to address that would be something like |
Here's an idea of how Let's say we start with 5 commits:
Running
Then,
Some notes:
WDYT? I'm not 100% sure myself whether I'd find such a command useful, but it seems possible and, again, there seem to be tools with the explicit purpose of making such a workflow work in git. |
I had originally wanted a simple command for just making a few commits siblings. Maybe your version could be For my use case (importing a bunch of Rust crates into Google's monorepo), I think the simple version that parallelizes all input commits would actually be enough. In the example you provided, I think I could then do this:
I hadn't thought of that multi-step process involving rebase before, but it seems like that would actually work well. |
True.
This would only work well if either
or
I'm not sure how important the case of 5 having children is, but if it does, I'm not sure rebasing them onto the parent of 1 is a good idea. |
Another random thought (probably not actionable at this point): this is actually similar to the potential direction the |
In the example above, it has commit 6 as child. That's what I based my example on.
Ah, I had assumed that that |
I'm still a bit confused, though maybe I figured it out. I was imagining that Now I'm recalling that maybe |
Ah, good point. Yes, I was relying on that behavior without really thinking about it. |
I don't find this behavior obvious, but we could maybe still have people rely on it if we explain it enough and encourage people enough to do it. (This was previously an update to a previous message) |
I removed the "Good first issue" label from this earlier today, but given that I again think the basic version I initially had intended is good enough, I'll add it back. |
I have the basic version of this implemented and will push a PR soon. |
I'm not observing this behavior in practice. jj seems happy to allow a commit to be a direct and indirect ancestor of another commit. Here's an example. I replaced the actual change ids with the numbers from above to make it easier to compare.
You can see here that 6 is a direct descendant of both 5 and 1. This issue is somewhat orthogonal to the |
Yes, that's correct. I actually changed the default quite recently. Now it's only the rebase command that simplifies ancestor merges. I agree that it's orthogonal to |
I used jj rebase in the example though, so I'm not sure what you mean. Mind clarifying? |
Sorry, I was confused. Even rebase preserves ancestor merges these days. The state I was thinking of was very short-lived and existed only within PR #3080, between commit 2bbefcc and commit bbda146. |
Since this has been implemented I'm going to close the issue. There were some interesting suggestions in this thread about how to further extend the command. Perhaps they can be moved to a separate issue if people are still interested. |
This came up in arxanas/git-branchless#757.
Assume we have a linear history like this:
We should provide a command that's something like
jj parallelize B:C
, which would reshape the history to be this:I don't know if we should insert an empty merge commit or let D' be a merge commit. Other VCSs might call that an "evil merge", but since merge commits are easier to work with in jj than in most other VCSs, it might be best to let D' be the merge commit. We could also make it optional.
The text was updated successfully, but these errors were encountered: