I've been trying out Jujutsu / jj. It uses git to store commits, and you can use Sublime Merge in a "colocated" git/jj repo with no problems and I have been for the last week. SM works perfectly as a commit browser & also as a mergetool from the command line. I'm not asking for any extensive JJ integration, because it's too young.
However, there is one isolated feature I think SM could add, along the lines of smerge mergetool, that would not require actual JJ integration, and would also be useful for regular Git users.
The feature is known as "3-pane diff editing". It's very similar to acting as a mergetool. The best overview of diff editing is in the diffedit3 readme. Docs on configuring a tool for it are here and this is where they configure command line args for Meld.
The inputs are directories, not single files. Temp directories, usually. 3 of them -- left, right, output, and output is writable.
You edit the middle pane, producing whatever intermediate state you want between the left & right.
If you jj split a commit C
It calls the diff editor with $left/$right/$output args, and output initially has identical contents to right
The diff editor shows you the files in those directories and lets you enter 3-pane mode on each one
At exit, two commits are produced: X = $output - $left and Y = $right - $output. Because left/right are not editable, you get XY = C.
If you exit with no changes, then X = C and Y is empty
If you copy the contents of the left pane to the middle and exit, then X is empty and Y = C.
If you copy some of the left pane but not all, you split C in two
If you "copy a hunk from the left to the middle", the difference is now between the middle & the right panes, so the hunk ends up in commit Y.
If you edit the middle pane to add a line, X contains +line, Y contains -line.
As you can see, this is basically like the git staging area but using temp directories, and without the option to "discard". This kind of thing is, in my opinion, SM's greatest strength as a git client. SM's staging area and mergetool are the best there is. I think you could combine them and be the best diff editor.
Preferred solution
SM could add a smerge diffedit command.
SM's commit/staging area UI is way more efficient than what Meld does here. Meld's is pretty lame -- you are initially shown three identical-looking filesystem trees, you have to double click on a file to see any diffs, and you can only look at one file at a time in full screen. So I kinda think you could just reproduce the SM commit/staging area UI without "discard" or "commit" buttons, and drop into 3-pane mode for a file if you click on an "edit" button, scrolled to the hunk you clicked it on.
I think you could also bring this feature to git users:
It would be nice to have an "Edit Commit > Split" button that lets you split with the same discard-less staging UI + 3-pane mode. Very often I want to split a commit exactly in two (often in order to to branch off the first one), but the "Edit commit contents" mode doesn't enforce that.
The 3-pane diff editing concept would also be useful to edit the contents of the Git staging area. Left=HEAD, middle = staging area (editable), right = working copy (probably also editable). Currently SM has no way to jump into its text editing / merge mode from the staging area for quick edits. I've wanted that for a while.
Alternatives
Don't
Screenshots
This is diffedit3. Looks like a mergetool, really. You can see it has multiple files to look at.
Problem description
I've been trying out Jujutsu /
jj
. It uses git to store commits, and you can use Sublime Merge in a "colocated" git/jj repo with no problems and I have been for the last week. SM works perfectly as a commit browser & also as a mergetool from the command line. I'm not asking for any extensive JJ integration, because it's too young.However, there is one isolated feature I think SM could add, along the lines of
smerge mergetool
, that would not require actual JJ integration, and would also be useful for regular Git users.The feature is known as "3-pane diff editing". It's very similar to acting as a mergetool. The best overview of diff editing is in the diffedit3 readme. Docs on configuring a tool for it are here and this is where they configure command line args for Meld.
jj split
a commit C$left
/$right
/$output
args, and output initially has identical contents to right$output - $left
and Y =$right - $output
. Because left/right are not editable, you get XY = C.+line
, Y contains-line
.As you can see, this is basically like the git staging area but using temp directories, and without the option to "discard". This kind of thing is, in my opinion, SM's greatest strength as a git client. SM's staging area and mergetool are the best there is. I think you could combine them and be the best diff editor.
Preferred solution
SM could add a
smerge diffedit
command.SM's commit/staging area UI is way more efficient than what Meld does here. Meld's is pretty lame -- you are initially shown three identical-looking filesystem trees, you have to double click on a file to see any diffs, and you can only look at one file at a time in full screen. So I kinda think you could just reproduce the SM commit/staging area UI without "discard" or "commit" buttons, and drop into 3-pane mode for a file if you click on an "edit" button, scrolled to the hunk you clicked it on.
I think you could also bring this feature to git users:
Alternatives
Don't
Screenshots
This is diffedit3. Looks like a mergetool, really. You can see it has multiple files to look at.