jj split
UX is somewhat difficult to use
#1905
Replies: 4 comments 17 replies
-
Thanks! I haven't read much of it yet, but I happened to notice that you said "so writing
Technically, that actually depends on your "diff editor". The default diff editor of
|
Beta Was this translation helpful? Give feedback.
-
I was going to say that I don't think most tools allow 3-way diffing, but then I tried with Meld and it seems to do exactly what I want! I think we should change the "diff editor" interface to have a third view for the output instead of having the right side be the output, at least for tools that support it. That shouldn't be very hard to do. Thanks a lot for bringing this up! I really like the idea of presenting the diff in 3 tabs. |
Beta Was this translation helpful? Give feedback.
-
I think a
I've recounted to @martinvonz on a few occasions the Facebook UI for this (in Atom/VS Code):
I have a branch locally embedding
|
Beta Was this translation helpful? Give feedback.
-
+1 to the general idea that: I've ended up recording a short 2 minute demo of the specific UI (magit) I personally need to be able to switch to jj: |
Beta Was this translation helpful? Give feedback.
-
I have been experimenting with using Jujutsu as my daily driver this month—and am writing up a long experience report on it, in hopes that it will be another small boost to Jujutsu (spoilers: I am a pretty big fan!). There is really only one area where I find jj to be a regression against Git, and that is around the behavior of
jj split
. The following is straight out of my WIP-writeup.Jujutsu treats the working copy itself as a commit instead of having an “index” like Git. Git really only lets you break apart a set of changes with the index, using
git add --patch
. Jujutsu instead has asplit
command, which launches a diff editor and lets you select what you want to incorporate—rather likegit add --patch
does. As with all of its commands, though,jj split
works exactly the same way on any commit; the working copy commit gets it “for free”.Philosophically, I really like this. Practically, it is a slightly bumpier experience for me than the Git approach at the moment. Recall that I do not use
git add --patch
directly. Instead, I always stage changes into the Git index using a graphical tool like Fork. That workflow is slightly nicer than editing a diff—at least, as Jujutsu does it today. In Fork (and similar tools), you start with no changes and add what you want to the change set you want. By contrast,jj split
launches a diff view with all the changes from a given commit present: splitting the commit involves removing changes from the right side of the diff so that it has only the changes you want to be present in the first of two new commits; whatever is not present in the final version of the right side when you close your diff editor ends up in the second commit.If this sounds a little complicated, that is because it is. There are two big downsides to this approach, philosophically elegant though it is. First, I find it comes with more cognitive load. It requires thinking in terms of negation rather than addition, and the “second commit” becomes less and less visible over time as you remove it from the first commit. Second, it requires you to repeat the operation when breaking up something into more than two commits. I semi-regularly take a single bucket of changes on disk and chunk it up into many more than just 2 commits, though! That significantly multiplies the cognitive overhead.
The net is: when I want to break apart changes, at least for the moment I find myself quite tempted to go back to Fork and Git’s index. I do not think this problem is intractable, and I think the idea of
jj split
is right. It just—“just”!—needs some careful design work. Preferably, thesplit
command would make it straightforward to generate an arbitrary number of commits from one initial commit, and it would allow progressive creation of each commit from a “vs. the previous commit” baseline. This is the upside of the index in Git: it does actually reflect the reality that there are three separate “buckets” in view when splitting apart a change: the baseline before all changes, the set of all the changes, and the set you want to include in the next commit. Existing diff tools do not really handle this—other than the integrated index-aware diff tools in Git clients!Mostly hoping to kick off a discussion about this here:
Beta Was this translation helpful? Give feedback.
All reactions