Most active commenters
  • stavros(4)
  • steveklabnik(4)

←back to thread

Jujutsu for everyone

(jj-for-everyone.github.io)
434 points Bogdanp | 20 comments | | HN request time: 1.815s | source | bottom
Show context
marcuskaz ◴[] No.45084298[source]
> Jujutsu is more powerful than Git. Despite the fact that it's easier to learn and more intuitive, it actually has loads of awesome capabilities for power users that completely leave Git in the dust.

Like? This isn't explained, I'm curious on why I would want to use it, but this is just an empty platitude, doesn't really give me a reason to try.

replies(7): >>45084316 #>>45084327 #>>45084439 #>>45084678 #>>45088571 #>>45092597 #>>45093098 #
senekor ◴[] No.45084439[source]
Hi, author here. Since the target audience is people with little to no Git experience, a detailed comparison would not make sense. I did simply make that claim because the weirdness of Git's UI is usually justified by saying how powerful it is. So this statement is just intended to ease the readers mind that they're not missing out on power by choosing a tool that's easier to learn.
replies(3): >>45084539 #>>45084685 #>>45087146 #
1. marcuskaz ◴[] No.45084685[source]
I suppose I want the article written for the experienced developer, convince me why I should try something different than the huge defacto standard that is git. I'm totally open to trying something new, but need a compelling case.

Beyond `jj undo` everything else in this thread feels just as complicated as git.

replies(3): >>45084810 #>>45088010 #>>45089061 #
2. baq ◴[] No.45084810[source]
do you know about git rerere? if yes, you might like jj.
replies(1): >>45089012 #
3. stavros ◴[] No.45088010[source]
There isn't a single thing in jj that's as complicated as git. I could go on to list a few features, but it would sound underwhelming, because you could do all that in git.

It's kind of like asking "why would I buy a digital camera when my film camera does all the same things? I can already see what the photo will look like when I take it, and developing my own film isn't that much of a hassle", yet film cameras have gone the way of the dodo, except for the occasional nostalgic enthusiast.

replies(1): >>45089289 #
4. spooneybarger ◴[] No.45089012[source]
This made me laugh. Thank you.
replies(1): >>45090168 #
5. Izkata ◴[] No.45089061[source]
A couple of them seem more complicated, like the example further up on the page for postponing merge conflicts. In git I'd just abort the merge and do it later.

I also found the exchange about named branches funny, that ends with:

> Ok, you need to call `jj bookmark set -r@ XYX` (or `jj b s -r@ XYX`), so what?

Apparently this is excusable, but people like to complain about git's commands being too obtuse - as far as I understand the git version is "git checkout -b XYX", right? (Or I guess "git switch -c XYX" with the new commands)

replies(2): >>45089144 #>>45091961 #
6. steveklabnik ◴[] No.45089144[source]
That’s backwards, your git command is “move to this branch” and the jj command is “update where the branch points to,” so git reset —hard.
replies(2): >>45089262 #>>45091987 #
7. Izkata ◴[] No.45089262{3}[source]
The git commands are "create new branch at HEAD and switch to it", and the context of the thread above sounded like that's the functionality they wanted?
replies(1): >>45089628 #
8. cortesoft ◴[] No.45089289[source]
I don't think this is what the person you responded to is asking.

Their question is more, "why would I buy a digital camera that takes pictures in a new format that only a few cameras understand? All my tooling, 3rd parties, and other camera I own use the standard format. Even though I can see why the new format has advantages, I am still going to have to use the other format for all these other photos I have to work with, and there aren't equivalent tools in the new format for all these other photos things I need to do. Even if I buy this new camera, I am still going to have to work with the old format, so I'll have to learn how to use two formats now, and get used to two tool chains. Since the existing format is something I am going to have to use either way, how is it worth it for me to have to use two formats?"

replies(1): >>45090523 #
9. steveklabnik ◴[] No.45089628{4}[source]
“jj bookmark set” doesn’t create a new branch and switch to it. It updates the head of an existing branch to a new place.

jj doesn’t have a “name a new branch and switch to it” command, because you usually don’t bother naming branches until you’re using them up to a forge, and there’s no “current branch” concept. I creat new named branches with “jj git push -c” which names it for me, and switching branches is closest to jj new or jj edit.

10. baq ◴[] No.45090168{3}[source]
It’s funny because it’s true! ;)
11. stavros ◴[] No.45090523{3}[source]
You don't have two formats, though. Jj transparently works with git. I use it for everything and none of my collaborators is even aware that I'm using jj.
replies(1): >>45092341 #
12. tsimionescu ◴[] No.45091961[source]
> as far as I understand the git version is "git checkout -b XYX"

The difference is actually worse than that. There is not the regular git equivalent, because this step is just done implicitly for you, normally. That is, with jj, just because you had checked out the head of main and then you added a new commit, doesn't mean your new commit is now the new head of main. `jj bookmark set -r@ main` is the way you tell jj to actually advance main to your latest commit.

But you are right - `git switch -C main` would be more or less the equivalent in git if you were working in detached head mode, which is how jj normally works (note the `-C`, not `-c`, to forcefully update main to point to this commit).

13. tsimionescu ◴[] No.45091987{3}[source]
They're closer to the right command than you are. `git reset --hard` will move HEAD to the given branch. The right command would be `git checkout -B branch` / `git switch -C branch`, to create or update `branch` to point to the current commit (except for the side effect that future commits will then go onto `branch` in git, while they won't in jj).

Basically, jj is just like working with git in detached head mode as far as I can tell.

replies(1): >>45096660 #
14. mcepl ◴[] No.45092341{4}[source]
If you say that you can work only with JJ and never use git, you are delusional. For one, where is that JJ forge (i.e., the equivalent of Sourcehut)?
replies(2): >>45092523 #>>45093066 #
15. Macha ◴[] No.45092523{5}[source]
GitHub, or sourcehut, or whatever you prefer.

Maybe you feel that jj git fetch and jj git push are using "git" but it means you avoid the git cli in favour of the IMO better designed jj cli.

16. stavros ◴[] No.45093066{5}[source]
I could respond to this uselessly pedantic comment, but then nobody wins.
replies(1): >>45093949 #
17. mcepl ◴[] No.45093949{6}[source]
I didn’t mean to be pedantic. My experience with Jujutsu was as bad as with Mercurial (and hg-git, I believe?) … after couple of hours working with my repo (https://git.sr.ht/~mcepl/m2crypto), looking at it with git, I got incomprehensible mess of destroyed multiple unmergeable heads (especially for Mercurial), and completely destroyed other branches, where I was not planning to work (Jujutsu). The only resolution in both case was export my work to plain patches, rm -r the checkout, clone again with git and forget anything about those other VCSes.

So, I claim that Jujutsu actually doesn’t work well with git repositories (and forges) very well, and I would like to see a native one.

replies(2): >>45094139 #>>45097232 #
18. stavros ◴[] No.45094139{7}[source]
It works fine for my use case, all my Github repos are in the state I'd expect, and I sometimes use git in my local repos as well, and that works fine. Hell, sometimes I use jj to fix a mess I made in git.

The only issue is being in detached HEAD all the time, but in practice it's not a big problem for me.

19. steveklabnik ◴[] No.45096660{4}[source]
You know, I was in the middle of some long flights and missed the -b! You’re right about that part, that’s my bad! I’m starting to forget git details at this point, haha. (I never used switch, always checkout -b)
20. steveklabnik ◴[] No.45097232{7}[source]
I am very confused as to what happened to you here, that’s not usual.

Most of jj’s stuff is purely local. I woke on GitHub with jj just fine, the only thing people notice is that my autogenerated branch named are a bit odd.