News for hackers. Stuff that matters.
Re:Jujutsu Primer by boltzmann64 on Friday November 20, 2026 @08:56AM (#50574721)
i really don't understand jj. what is the point of deleting the useful stage and treating the worktree as the project, which contains your debug harness, compiler artefacts, build files, and other things that you generally don't want in your project. you have to either write a .gitignore counterpart for jj or manually remove them before committing.

just treat your stage as the real project and worktree as some ephemeral sandbox. as you work build your index in stages by `git add -e` and removing your debug harness hunks. as soon as you reach a milestone, just commit and type your message when the context is fresh in your head.

with jj, you work all day and finally when you are ready to commit, you now have to manually remove your debug harness, remove build artefacts, and reverse engineer your own code to write a commit message when you just want to go home.

stop treating the stage as a implementation detail poking out into userspace. if it was just a implementation detail, linus wouldn't have defended it so fiercely.

Re:Jujutsu Primer by mirashii on Friday November 20, 2026 @09:10AM (#50574896)
Stage or no, git or jj, not writing a gitignore once and never worrying about removing hunks as you described or filtering the list of unstaged files in your brain for debug artifacts seems like completely unnecessary cognitive load. I’ve never come across a project that staunchly refuses to gitignore the paths of build artifacts that shouldn’t be checked in. It’s basic hygiene to prevent accidents. I really can’t understand any reason to oppose doing so.
Re:Jujutsu Primer by boltzmann64 on Friday November 20, 2026 @10:38AM (#50576322)
it only causes accident if you do git add --all. and my exact thesis is to be deliberate about what you commit.

`git add -e` your files as you are satisfied (of course after remove your debug harness). this way you debug harness stays put in your sandbox/worktree and no harness leaks into your project which remains pristine. this is something that .gitignore cannot do. jj cannot. you have remove all your harness, TODOs and others just to commit and then add it back again. that just means your version control failed.

and no, i am not advocating you should no add .gitignore.

Re:Jujutsu Primer by mirashii on Friday November 20, 2026 @10:50AM (#50576529)
> you have remove all your harness, TODOs and others just to commit and then add it back again

No, you don't. You can split. You can untrack. You can change your auto-track configuration. There are many ways to deal with this other than having to remove them. You can be equally deliberate about what goes into your final commit.

Re:Jujutsu Primer by rbehrends on Friday November 20, 2026 @09:53AM (#50575475)
I found that annoying, too, until they introduced the snapshot.auto-track configuration option. Here's an example for a basic Rust project:

  [snapshot]
  auto-track = """
    root-glob:"{src,tests}/**/*.rs" |
    root-glob:"Cargo.*" |
    root-file:"README.md"
  """
I set it to `snapshot.auto-track = "none()"` in the global config so that it is turned off by default and then selectively adjust it for a project.

You can also leave it as `none()` and then manually add files as before.

Note also that this has nothing to do with the staging area, but with selecting which files to add to a repo, which other VCSes can do just fine without having a staging area.

In fact, selective auto-track plus not having to explicitly stage changes makes it less of a risk that you forget to add something.

Re:Jujutsu Primer by boltzmann64 on Friday November 20, 2026 @10:59AM (#50576722)
i think forgetting to add something to stage is no worse than adding your debug to master/main because auto track added it. again, i appeal that please be deliberate about what you are adding. after all software engineering is a craft, so craft you commits.
Re:Jujutsu Primer by rbehrends on Friday November 20, 2026 @11:52AM (#50577756)
> i think forgetting to add something to stage is no worse than adding your debug to master/main because auto track added it.

I agree with that, which is why I pointed you at the auto-track setting. I also think that automatically adding everything is a poor default.

> after all software engineering is a craft, so craft you commits.

I could not disagree more. Reliability dictates that you minimize the risk of errors, including those from having unnecessary manual steps for frequently repeated operations.

My point here is especially git vs. pretty much any other VCS aside from jj, not git vs. jj; do not assume there are only two options here. Being explicit about adding files to a repo is generally a good idea. Having to repeat the process for already added files for every commit is just another opportunity for errors.

And as I wrote in another comment [1], I actually consider the staging area an anti-pattern for unrelated reasons.

[1] https://news.ycombinator.com/item?id=50573492

Re:Jujutsu Primer by steveklabnik on Friday November 20, 2026 @12:00PM (#50577933)
jj makes it easier to craft good commits than git does. This is specifically because the index is just another commit. You cannot apply your slice and dice tools to the index in git, but you can with jj, since the index is a commit like any other.
Re:Jujutsu Primer by bilkow on Friday November 20, 2026 @10:07AM (#50575700)
I agree with you but I think that's more of a problem of the tutorials / docs out there than of the tool, which feel like they sell not reviewing your changes before committing as a selling point (that I disagree with). It seems like you just want what's usually called the "squash workflow"[0]. You create a new change on top `jj new`, when you want to "stage" changes, you can use move them to the parent commit by using `jj squash -i` to choose them interactively, or `jj squash path/to/file1 path/to/file2` to choose which files you want to move (similar to `git add`).

In practice I usually just use `jj commit -i`, where you just select the files you want to keep there, edit / add the description (commit message) and a new change is created on top for your new working area.

> compiler artefacts, build files

I agree with my sibling those should be .gitignored and if not, yes those those may cause problems with `jj`

> debug harness

I think that works pretty well with `jj` actually. Let's say mid work you're interrupted and needs to check a an commit. `abc` is your current working copy and `def` is the commit you want to checkout. You can leave your harness behind (`jj new def`), do whatever you need there, then come back (`jj edit abc`). You can also bring your harness with you with `jj rebase -s @ -o def`. If it's something you commonly use, you can create a change for it and keep it as a parent, and then use a filter to prevent changes starting with a prefix (let's say local:) from being pushed. That said, there are some rough edges about keeping changes as a parent IMO (like having to set up command aliases or keep having to move it, depending on your workflow).

[0] https://steveklabnik.github.io/jujutsu-tutorial/real-world-w...

Re:Jujutsu Primer by boltzmann64 on Friday November 20, 2026 @10:48AM (#50576489)
if you are mid work and suddenly need to checkout something you checkout in a new worktree so that all your context remains intact. `git worktree` has been in stable since 2015.

i have not used jj, but if you are introducing sqaush/new just you get what the stage does cleanly then you are implictly agreeing with the stage model.

Re:Jujutsu Primer by skydhash on Friday November 20, 2026 @10:53AM (#50576602)
> Let's say mid work you're interrupted and needs to check a an commit. `abc` is your current working copy and `def` is the commit you want to checkout. You can leave your harness behind (`jj new def`), do whatever you need there, then come back (`jj edit abc`). You can also bring your harness with you with `jj rebase -s @ -o def`.

It was not complicated with git either. If there was some important change that I didn't want to commit yet, I stash it. Same with experiments that contained valuable information. Then I can use stash apply whenever I want. Never had trouble jumping around the git graph.

One key thing is that I find that conflicts are a very good signal for when the intent of the worktree at commit c clashes with the intent of patch p. Especially if you've designed the code to follow the single responsibility principle. I don't want to sweep this under the rug. Instead I want to solve it right away.

A lot of jj advocates need to better highlight their workflows and why they think git was not doing well for them. I think there's too much focus on managing files instead of unit of changes (contained in patches).

Re:Jujutsu Primer by steveklabnik on Friday November 20, 2026 @11:59AM (#50577902)
Same as the index, the stash is also just a commit. It's not that it's impossible to do any of this in git, it's that it's more orthogonal in jj. Commits, the stash, and the index are three features in git, but a single feature in jj. This also means you can bring all of the tools to use on your psudeo-index and psuedo-stash that you use to work with commits.
Re:Jujutsu Primer by skydhash on Friday November 20, 2026 @12:25PM (#50578441)
My mental model is like this

commits: clean patches that have been integrated somehow (even as a draft version in my local repo)

index: patch in progress (very short lived as I usually add things and commit right after). It's an editing space.

stash: valuable patches in terms of knowledge, but not relevant to any current task

While they look similar, they have different purposes and so interact with different tools.

I code for one purpose (and maybe get distracted for one thing or two) then goes on to clean up the patches and write a proper message. It's not a matter of adding and rejecting hunks. I also do edit them normally. Tooling is not a problem as I spend more time on reading and editing than on tool calls.

Stashing is similar. The patches stored there are individuals, meaning I don't have to worry about dependency when I delete one. I also don't have to worry about location as there's just one stash concept.

You can also find a way to do the same operation in jj, but I want tooling centered around the concept of a patch, not the concept of commits. jj make it awkward to work with patches.

Re:Jujutsu Primer by steveklabnik on Friday November 20, 2026 @12:31PM (#50578577)
Sure, I agree with all of this. I just think jj supports doing all of this even easier than git does.
Re:Jujutsu Primer by BeetleB on Friday November 20, 2026 @10:32AM (#50576196)
> i really don't understand jj. what is the point of deleting the useful stage

You have a much more flexible stage in jj than in git. It's not gone anywhere. They just promoted it to first class and don't call it a stage.

> you have to either write a .gitignore counterpart for jj or manually remove them before committing.

I'll admit it is a pain. The one nice outcome, though, is that you now have everything in .gitignore and don't get "?" in your status.

> just commit and type your message when the context is fresh in your head.

The nice thing about jj is you don't need to worry about the "fresh in your head" part. You can write the commit message before you even begin, and modify it as you go along. You can commit things with no message (which I sort of use as staging), and much later, after several commits, go back and put in the message.

Re:Jujutsu Primer by boltzmann64 on Friday November 20, 2026 @11:04AM (#50576802)
so jj devs reinvented the stage with extra steps and realize the foresight that linus had quarter century ago.
Re:Jujutsu Primer by steveklabnik on Friday November 20, 2026 @12:02PM (#50577960)
It's fewer steps, because it is not an additional concept, just the same concept as the others. Better factored.
Re:Jujutsu Primer by BeetleB on Friday November 20, 2026 @01:57PM (#50579955)
Fewer steps on average. When you don't need to be selective you don't need to do "git add", for example. Most of my commits when I used git were that way. Forcing me to do a git add each time added friction.

jj gives you the best of both worlds. If you want the friction, you can have it - with no more commands than with git. If you don't want it, fewer commands. And if you want a fancier stage you can have that too.