Re:Jujutsu for Everyone
by steveklabnik on Monday September 01, 2025 @03:12AM
(#45090278)
Selectively staging is easier in jj. I loved git’s index, jj does it better.
[ Parent
| on HN ]
How? The jj documentation seems to be pretty clear about getting rid of the staging area.
Re:Jujutsu for Everyone
by Human-Cabbage on Monday September 01, 2025 @03:44PM
(#45095953)
There are a couple main ways to achieve a workflow similar to Git's staging area.
#1: Squashing
Create a revision for the feature, then create another revision atop that.
$ jj new main -m 'feature'
$ jj new
$ jj
@ trtpzvno [email protected] 2025-09-01 12:32:33 9ac76a0f
│ (empty) (no description set)
○ wvzltyyr [email protected] 2025-09-01 12:32:31 80b2d5d0
│ (empty) feature
◆ zxrulorx [email protected] 2024-12-11 03:44:38 main 351a2b30
│ all the stuff
$ vim
$ jj
@ trtpzvno [email protected] 2025-09-01 12:34:50 5516c2b9
│ (no description set)
○ wvzltyyr [email protected] 2025-09-01 12:32:31 80b2d5d0
│ (empty) feature
◆ zxrulorx [email protected] 2024-12-11 03:44:38 main 351a2b30
│ all the stuff
~
$ jj squash -i
# interactively choose hunks to squash into parent
$ jj
@ oxqnumku [email protected] 2025-09-01 12:35:48 8694aa34
│ (empty) (no description set)
○ wvzltyyr [email protected] 2025-09-01 12:35:48 47110bff
│ feature
◆ zxrulorx [email protected] 2024-12-11 03:44:38 main 351a2b30
│ all the stuff
~
#2: SplittingCreate a revision for the feature, then split it up retroactively.
$ jj new main -m 'feature'
$ jj
@ snomlyny [email protected] 2025-09-01 12:38:39 84c6ecaa
│ (empty) feature
◆ zxrulorx [email protected] 2024-12-11 03:44:38 main 351a2b30
│ all the stuff
~
$ vim
$ jj
@ snomlyny [email protected] 2025-09-01 12:39:51 8038bdd4
│ feature
◆ zxrulorx [email protected] 2024-12-11 03:44:38 main 351a2b30
│ all the stuff
~
$ jj split
# interactively choose hunks to keep, splitting the rest into a new revision
$ jj
@ zpnpvvzl [email protected] 2025-09-01 12:41:47 5656f1c5
│ debugging junk
○ snomlyny [email protected] 2025-09-01 12:41:44 1d17740b
│ feature
◆ zxrulorx [email protected] 2024-12-11 03:44:38 main 351a2b30
│ all the stuff
~staging isn't needed since everything including the working copy is a commit you can split, rebase, etc. without any checkin step. yes, it does make sense and yes, it works in practice - the uncommitted vs staged vs committed states are very git-specific and don't need to be special in any way. if you check in the wrong thing (note - your working copy is a commit, so by definition you can't not have wrong things checked in at times) you split it (stage and/or commit in git).
Re:Jujutsu for Everyone
by steveklabnik on Monday September 01, 2025 @05:11PM
(#45096638)
Because it’s not a distinct feature, it’s just another commit. Which means you can bring all of the usual tools for modifying commits to bear. My sibling has some details, but at the high level, that’s the idea.