top | item 42488112

The Jujutsu version control system

140 points| imajoredinecon | 1 year ago |neugierig.org

50 comments

order

gcr|1 year ago

I use jj for all my projects on github! It's really useful for my sort of workflow: chains of commits with easily-editable history. If you make a change back in time, you edit the previous commit (which puts you in a state similar to git's detached head), and any edits you make there are automatically carried forward (rebased) onto descendants. It feels way more natural, especially for newer users.

The killer feature that I love the most is a small one, but it's that commit messages can be made ahead of time rather than after-the-fact. So I can sit down at my desk, say

    jj new -m "Work on XYZ feature"
then edit my code in the editor. When I'm finished, I move on to the next commit:

    jj new -m "Working on UVW feature"
No more "oh no I accidentally started touching code and forgot to commit my work, so now I have to manually split two git commits;" it's a small way that the tooling encourages you to be intentional about your engineering philosophy.

miki123211|1 year ago

> It feels way more natural, especially for newer users.

I have thought about this recently, and it feels like jj would be a lot easier to teach to new users than git.

For one, jj lets you work on things directly without having to worry about an index, while still giving you all the advantages of one if you're advanced enough to need that.

THe commands also feel a lot easier to explain than in git. For example, you use `edit` to change what commit you're working on, `restore` to copy a file from a commit to your working directory (and abandon your changes to it), and `abandon` to drop a commit completely. Meanwhile, git has `checkout`, `restore`, `switch`, `reset` and `reset --hard`, which all do various parts of one or more of these.

frizlab|1 year ago

This might be the single most compelling reason I’ve ever read to try jj. I won’t, but thanks for this particular feedback.

fragmede|1 year ago

I use git add -p to deal with that particular issue, but it's great that other people are making and finding tools that work for them.

ghfhghg|1 year ago

Sounds kind of like perforce

adastra22|1 year ago

You can edit your commit message ahead of time in git too.

dang|1 year ago

Recent and related:

I'm daily driving Jujutsu, and maybe you should too - https://news.ycombinator.com/item?id=42380306 - Dec 2024 (47 comments)

Others:

Git and Jujutsu: In Miniature - https://news.ycombinator.com/item?id=42111597 - Nov 2024 (72 comments)

Jujutsu (jj), a Git compatible VCS - https://news.ycombinator.com/item?id=41895056 - Oct 2024 (110 comments)

Steve's Jujutsu Tutorial - https://news.ycombinator.com/item?id=41881204 - Oct 2024 (116 comments)

Jujutsu Strategies - https://news.ycombinator.com/item?id=41468750 - Sept 2024 (1 comment)

Jujutsu: A Next Generation Replacement for Git - https://news.ycombinator.com/item?id=40908985 - July 2024 (80 comments)

Lazyjj: TUI for Jujutsu/Jj - https://news.ycombinator.com/item?id=40859315 - July 2024 (1 comment)

A better merge workflow with Jujutsu - https://news.ycombinator.com/item?id=40842762 - July 2024 (90 comments)

GG, a GUI for Jujutsu - https://news.ycombinator.com/item?id=39713896 - March 2024 (2 comments)

jj init – getting serious about replacing Git with Jujutsu - https://news.ycombinator.com/item?id=39232456 - Feb 2024 (110 comments)

Jujutsu: A Git-compatible DVCS that is both simple and powerful - https://news.ycombinator.com/item?id=36952796 - Aug 2023 (261 comments)

Jujutsu: A Git-compatible DVCS that is both simple and powerful - https://news.ycombinator.com/item?id=36371138 - June 2023 (1 comment)

Jujutsu – A Git-compatible DVCS that is both simple and powerful - https://news.ycombinator.com/item?id=30398662 - Feb 2022 (228 comments)

sam_goody|1 year ago

What front ends work with jujutsu? Do I have to start doing all on the command line, or can I use existing clients such as Fork?

Kudos for the article. I have been seeing jj here and there, but this is the first that made me want to try it.

nulld3v|1 year ago

AFAIK there is no polished standalone frontend for jj yet. https://github.com/gulbanana/gg comes closest but I ran into some quirks when using it on git compatible/colocated repos.

Someone has made a VSCode plugin but it's closed source and I believe it will be paid at some point? https://www.visualjj.com/

If you are willing to use a TUI, jj-fzf (https://github.com/tim-janik/jj-fzf) has been wonderful and development is extremely active too.

I exclusively use git through the GUI, but the jj CLI improves so much over the git CLI that I'm willing to live with the CLI for now.

Still hoping that the GUIs become more polished though, and also for Inteliij IDEA integration.

lawn|1 year ago

I've been itching to use jj for real but the lack of a dedicated Neovim plugin killed my enthusiasm a bit.

Yes, regular git plugins sort-of mostly works, but it's different enough to introduce a lot of painful edges when you do.

setheron|1 year ago

The jj community on discord has been great also. It took a while for it to sync in but when I use git now it feels "wrong"

ziml77|1 year ago

This is the first summary of Jujutsu that has made me truly want to give it a try. I had it on my radar as something to check out but never felt motivated to because it seemed like I was going to have to put a lot of effort into changing my workflow from the one with the default Git porcelain. Based on this post, it sounds very logical and I'm looking forward to trying it on a project at work.

thibran|1 year ago

How do the rebased commits work when working with others together on a branch?

mpalmer|1 year ago

It's no different from how rebasing works in any shared git project; rebased commits are re-created with different SHAs.

forrestthewoods|1 year ago

I’m quite happy with Sapling at work. I still haven’t figured out what Jujutsu does better. I think nothing substantial? Not that Sapling can be easily used in the public sphere. But at a conceptual level I’m not sure there’s anything in JJ I’m missing.

sunshowers|1 year ago

Sapling is great. I worked on it for many years at Facebook and I think we did a pretty good job building a workflow that most developers preferred to Git.

To the extent that Jujutsu is similar to any other systems, it is most similar to Sapling — both have a Mercurial heritage (Sapling is derived from hg, while Jujutsu is a new codebase with an hg-inspired UX). However, Jujutsu introduces a number of fantastic improvements over Sapling, such as first-class merge conflicts and automatic working copy snapshots. See my testimonial, the top one on this page:

https://jj-vcs.github.io/jj/latest/testimonials/#what-the-us...

I no longer do VCS development, but I'm a very happy full-time jj user. I've also helped onboard a number of people onto it.

(Personally, I'm just happy that after the dark era of Git's branch-first UX being dominant, the anonymous heads/commit-first UX pioneered by Mercurial is making a resurgence. The vast majority of developers prefer a commit-first UX, and it is so much easier to explain things like stacked commits if you don't have to introduce git rebase -i.)

bsder|1 year ago

Sapling is Mercurial with some advancements. Mercurial is ridiculously better than git, but lost the network effects battle due to Github. So, JJ probably doesn't give you anything amazing.

JJ is useful for those of us who understand the shittiness of Git but have to work in a world that got locked into path dependent network effects by VC money.

akdor1154|1 year ago

Great article. How do people deal with the lack of branches, esp in a full time setting where it's common to have a few independent features on the go?

fprotthetarball|1 year ago

There are still branches, but they aren't named by default. You give them names with "bookmarks", which you can push to remote git repositories as branches.

This lets you work on things without having to worry about giving it a name. This turns out to be pretty helpful when you're experimenting — just "jj new <revision>" and start editing. If it turns out to be something you want to share, "jj bookmark create <name>" and then you can push it. (You can also push without giving it a name, in which case you'll get a git branch with a name based off of the change id.)

Change IDs stay constant with each change, so you use those as a type of branch name when switching between the features you're working on.

sunshowers|1 year ago

So, with VCS in general you don't really need to have branches to be able to track multiple independent changes. (With Git you do, but that's an artifact of Git's model, not an inherent property of source control.)

What you do need is a good way to visualize what work you have in flight. With Jujutsu that's as simple as typing in `jj` on the command line.

At Facebook it was common for even junior devs to have 5-6 changes in flight with nary a branch in sight, and experienced devs like myself routinely had dozens.