1. I write some code.
2. I realise it makes sense to commit as two commits.
3. I stage changes for the first commit & commit it.
4. I stage the remaining changes and commit those.
How would that work in JJ? I guess you do things in a different order somehow?
It's vastly more efficient and ergonomic - no staging area to think about, remember, stumble over, etc.
It's all dead simple if you use jjui - don't even need to learn any jj syntax
* working tree == in progress
* staging area == finished
How do can I split modifications to a single file into multiple commits? (In git)
Indeed. One nice thing about this is you can have a staging area for the staging area (repeat ad nauseum). It's not that unusual that I treat a commit as the staging area, and then I want to do something experimental on top of it, and make a new commit on top of my staging area and try things out there - ultimately to squash into my main staging commit.
In my last job I gave a presentation on jj and I hammered this point. I said it's like git but with everything version controlled. The index/staging is version controlled. The stash is version controlled. Technically even things like setting/unsetting bookmarks, commit descriptions etc are version controlled.