←back to thread

128 points nvader | 2 comments | | HN request time: 0s | source
Show context
fusslo ◴[] No.46192929[source]
I don't understand the workflow that makes JJ more useful than git. I dont think I've even had the idea of having multiple worktrees going at once. What is the use case? The author mentions being blocked by CI flow. Don't you have CI running on gitlab or github? just commit and push the branch and run CI. The author mentions stashing the changes, but like.. if you're running against CI, isn't it in a state that is commitworthy? I don't see how creating a worktree in a new folder and opening a new editor is more convenient than creating a branch at a certain commit.

I can understand if you need to run a CI or unit tests locally. Is that it?

I am not attacking JJ, I genuinely can't understand its value in my current workflow.

replies(9): >>46193047 #>>46193118 #>>46194204 #>>46194494 #>>46194612 #>>46194856 #>>46195079 #>>46200711 #>>46202517 #
nvader ◴[] No.46195079[source]
Specific workflows that I use in jj vs git:

1. Stacked PRs. I like to be kind to my reviewers by asking them to review small, logically-contained pull requests. This means I often stack up chains of PRs, where C depends on B depends on A, and A is being reviewed. If I receive feedback on A, jj enables me to incorporate that change within A, and flows those changes down into my dependent branches. I can then merge and close out A, whole continuing to work on B and C. Achieving this in raw git is labour intensive and error prone.

2. Easily fix up commits. I like to work with atomic commits, and sometimes I realize that I've made a typo in a comment, or a small error, or missed a test case. Jj makes it really trivial to timewalk back to the commit in question, fix it and resume where I left off.

3. Decompose a big PR into multiple PRs. This is the flip side of point 1: I can take my own big PR and rearrange and partition the commits into A, B and C so that they can easily be reviewed.

In general, jj seems to encourage and reward you for being disciplined with your commits by enabling you to be more flexible in how you stage, review and ship your code.

On the flip side, if you're the kind of person who is used to typing `git commit --all --message "xxx"` you might not get as much value from jj until that changes.

replies(1): >>46210078 #
frio ◴[] No.46210078[source]
I kind of don't get this comment. Isn't the `jj` default behaviour effectively `git commit --all`? There's no staging area -- and I personally find `git add` or `git add -p` a better UI than `jj commit -i`.

Meanwhile, there are git tools that solve the above three problems. My organisation uses `git-spice` (https://abhinav.github.io/git-spice/) which tightly integrates with Github to give you stacked PRs, editing of branches and management of your stacks in Github.

I've been trying jj for a while now because Steve Klabnik heavily recommended it, and so far it hasn't clicked in as nicely as my existing git setup.

replies(2): >>46211327 #>>46218877 #
1. steveklabnik ◴[] No.46218877[source]
FWIW as a fan of git add -p I tend to use the “squash workflow” rather than commit -i.
replies(1): >>46223298 #
2. frio ◴[] No.46223298[source]
Thanks, I'll try that :). Despite the fact that I've worked my way back to `git` for my mainline work, I've still got some repos that I've left jj live in to keep picking away at it.