-
Notifications
You must be signed in to change notification settings - Fork 356
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
FR: jj split --horizontal/--siblings/--sideways
#2274
Comments
I keep running into the lack of this. In my case, |
This shouldn't be hard to implement, if you're interested. Let's say we have history like this:
The user now runs |
Thanks for the explanation! I may have time to work on some jj PRs some weekend soon. |
I'm going to look into implementing this, but I'd like a clarification. It sounds like Solson and Martin are describing different things. I think that Solson is describing a command that does something like this:
I think Martin is describing a command that does this:
Is this feature meant to do 1, 2, both, or something completely different? |
This is what I would expect, personally. In my earlier comment I was referring to a usecase where the revision I'm splitting has no children in the first place, i.e.
Where |
Ok got it. So then to get to the first state we could do this:
|
If the --siblings option is used, the target commit is split into two sibling commits instead of parent and child commits. Any chilren of the original commit will have both sibilings as their new parents. ISSUE=#2274
If the --siblings option is used, the target commit is split into two sibling commits instead of parent and child commits. Any children of the original commit will have both sibilings as their new parents. ISSUE=#2274
I have this halfway working in #3037. By halfway, I mean that it is able to handle the simple case:
I'm still familiarizing myself with the internals to figure out the best way to handle the case where commit B has children that need to be rebased onto B1 and B2. If anyone has suggestions please let me know. Adding both siblings to the In that case, the log looks like this, where the commits with descriptions "Add file3" and "Add file1 and file2" are the originals and qtulxkyw is the commit being split.
I think I'm going to need to change how |
I actually thought that would work. Anyway, the way regular (serial) split is a bit weird and it's probably a good idea to do the rebasing of children manually for that case, so maybe it's good to do it for sibling split as well. The drawback is that we would need to replicate some of the logic from |
If the --siblings option is used, the target commit is split into two sibling commits instead of parent and child commits. Any children of the original commit will have both sibilings as their new parents. ISSUE=#2274
I think I have this done and ready for review and polish in #3037. |
I'm not sure all of the considerations in #2274 (comment) are addressed though. I'm still setting the rewritten commit to the second commit, so any branches are moved to the second commit and it is checked out as the working copy. I don't think that checking out the second commit is an issue (presumably we have to pick one), but perhaps we should leave any branches in a conflicted state. Thoughts? |
If the --siblings option is used, the target commit is split into two sibling commits instead of parent and child commits. Any children of the original commit will have both sibilings as their new parents. ISSUE=#2274
Good question. I think it would make more sense to leave the branch in a conflicted state, but it seems like it's practically quite useful to leave it on one of the commits instead. That way it requires action from the user in some of the cases instead of all of the cases. I'd say we should leave it that way for now and change it later if we hear that it's confusing - or worse, that it leads people to push the wrong commit to a remote. By the way, we have had a discussion internally at Google about where regular (parent/child) |
If the --siblings option is used, the target commit is split into two sibling commits instead of parent and child commits. Any children of the original commit will have both sibilings as their new parents. ISSUE=#2274
If the --siblings option is used, the target commit is split into two sibling commits instead of parent and child commits. Any children of the original commit will have both sibilings as their new parents. ISSUE=#2274
If the --siblings option is used, the target commit is split into two sibling commits instead of parent and child commits. Any children of the original commit will have both sibilings as their new parents. #2274
If the --siblings option is used, the target commit is split into two sibling commits instead of parent and child commits. Any children of the original commit will have both sibilings as their new parents. #2274
If the --siblings option is used, the target commit is split into two sibling commits instead of parent and child commits. Any children of the original commit will have both siblings as their new parents. #2274
If the --siblings option is used, the target commit is split into two sibling commits instead of parent and child commits. Any children of the original commit will have both siblings as their new parents. #2274
I created #3419 to discuss what happens to branches when a commit is split. Currently both |
If the --siblings option is used, the target commit is split into two sibling commits instead of parent and child commits. Any children of the original commit will have both siblings as their new parents. #2274
Closed by #3037. The new option is If anyone has opinions on the name we can still easily change it until the next release. Feel free to open a new issue :) |
Is your feature request related to a problem? Please describe.
Sometimes it's useful to split a commit "sideways", producing two or more siblings instead of a chain of commits.
Describe the solution you'd like
We talked about adding a way of splitting commits sideways on Discord at some point. The same request just came up for Mercurial in a chat group at Google.
Describe alternatives you've considered
An alternative is to let the user finish splitting the commits and then let them flatten the result using something like #1079.
The text was updated successfully, but these errors were encountered: