Live data from Hacker News

Jujutsu for busy devs

maddie.wtf

431–440 of 552 posts

Re: Jujutsu for busy devs

#431

Don't want to sound old school, but git works perfectly fine. The learning curve might be a bit difficult, but afterwards everything makes sense. And let's be honest, you just need a few actions (pull, add, reset, branch, commit) to use it in 95% of the cases.

If you work in a team you need to understand rebasing and squashing, unless you can convince team to never use these features. A lot of people are religious about rebasing, "clean" commit history. But it's pretty much incompatible with several devs working on a single branch. I.e. when you work on something complex, perhaps under time pressure, git habits bite you in the ass. It's not fine.

> A lot of people are religious about rebasing

Years and years ago I worked on a team where linear commit history was required so every time a merge happened you had to manually rebase and push to Bitbucket. I put a PR in halfway through the sprint, rebased it a dozen times as everybody else's work got merged, and had nothing to show during review because nobody bothered to check mine and the only coworker I had in the same physical office was out on vacation.

When I interview for new roles I always make a habit of asking how work gets done to avoid shops that engage in these types of shenanigans.

Re: Jujutsu for busy devs

#432

Earlier quoted context omitted.

I wonder when LLMs will start messing with VCS. That will be fun :-/

Most coding llms already know git, and can handle jj pretty well too.

I expect them to, I ment, that as part of modifying the code the issue commands that affect the VCS. This would be annoying, because you then can't rely on the VCS to tell you what the LLM did.

Re: Jujutsu for busy devs

#433

Earlier quoted context omitted.

You know your evangelists have gone haywire when they're explaining that your requirements are wrong instead of listening.

I don't think that's a fair characterization. It's more that there isn't really a big difference between the workflow of # you're on staging area @ commit A # make some untracked changes and console logs you don't wanna commit git add -p && git commit # select only what you want vs # you're on @ empty commit | commit A # make some local changes (which are tracked in @) jj commit -i # select only what you want You're…

Wait, what happens when there is a multi-GB file laying around and a jj command is being invoked? Does it start to scan it or is there some threshold. What does it do with cyclic hard-/sym-links?

Re: Jujutsu for busy devs

#434

Earlier quoted context omitted.

Counter point: I adopted it internally at Google (there's a backend for Piper, Google's monorepo Perforce thingy). I don't do my day-to-day work in the monorepo but I still jump in there once or twice a week. I adopted JJ because the existing frontend (Mercurial-based) is slow while JJ is fast. It's nice, I really like it! I'll probably switch to it as my main VCS eventually. But it doesn't feel that important to me.…

> I don't do my day-to-day work in the monorepo Is this one of the repos that uses Gerrit? Does JJ play well with Gerrit? IIRC Gerrit was super picky about amending commits and I was worried JJ's laissez faire attitude about creating git commits on demand wouldn't jive well.

> Does JJ play well with Gerrit?

There was a PR for a `jj gerrit` command, but at this point, it's not super needed. Here's the main bug tracking this https://github.com/jj-vcs/jj/issues/4387

Beyond that, the jj, gerrit, and git butler folks are working together on standardizing the change ID concept so they all work well together without extra tooling. That's going to take a long time though. Think "store the change ID in the commit rather than as a trailer", that kind of thing.

Re: Jujutsu for busy devs

#435

Earlier quoted context omitted.

I feel like I just outlined a situation where something that's weird in git is completely natural in jj. Maybe I miscommunicated?

I think you communicated well, probably I did not. > suspending the rebase and going to do something else This is what I find to be weird, personally. When doing a rebase, there’s no way I want to do something else in the middle of it, and having a modal state feels totally natural to me. At first approach (I read a (very good) intro[1]; I did not try), it seems there’s a lot of new things to learn (for instance the…

> When doing a rebase, there’s no way I want to do something else in the middle of it, and having a modal state feels totally natural to me.

This is a consequence of rebases being a special, modal state that requires dedicated focus to work through to resolution.

Rebase conflicts are (to a jj user) just another fix you might want to make to a revision. Or it might be better done by making a tweak to an earlier revision, instead of the revision where the conflict first occurred. There’s no pressure to fix it right this second, you can always come back where you left off. And you can make your fixed in a separate commit that you squash into the conflicted commit if it’s particularly hairy.

> It feels like jj is solving a lot of problems that do not exist, or are mostly solved with worktrees.

Git has grown a lot of features over the years and countless flags to make some things feasible.

jj rethinks the core interaction model in a way that gets rid of all the band-aids.

There are people who still live and die by C and swear that anyone running into issues is holding it wrong or just needs to be more principled about how they handle memory. But most people have moved on to higher-level languages. It doesn’t mean C was a bad language, it doesn’t mean those programmers weren’t familiar with C, and it doesn’t mean there aren’t still some cases where C is the right answer. But most people nowadays find other languages more productive with less friction.

Re: Jujutsu for busy devs

#436
post #423

Earlier quoted context omitted.

>> git commit --fixup > jj just does it correctly by default. JJ adds changes to random old commits instead of the newest one? Yikes. > rerere by default Takes space and time. > --update-refs by default Maybe sensible, don't need it most of the time.

> JJ adds changes to random old commits instead of the newest one? Yikes. jj adds changes to the current commit, which is the staging area, which is the index, which is the working copy. I get you don't like it, no need to be an ass about it, but denying that it works is just that, denial. > > rerere by default > Takes space and time. doesn't take my time. I'll take it. > > --update-refs by default > Maybe sensible,…

> no need to be an ass about it

That wasn't what I meant, git --fixup is for changing earlier commits, you answered as if it didn't that's what I wanted to point out. (I tried to be sarcastic, because it was obvious that you didn't mean that.)

>> Maybe sensible, don't need it most of the time.

As in I want the opposite behaviour most of the time. That's why that is the default.

Re: Jujutsu for busy devs

#437
post #384

Earlier quoted context omitted.

I think `git add -p` and its friends are another thing I'd point to for this. I've never really struggled too hard to get git commits into different branches for review, but if you've put unrelated changes into the same working dir, you'll want `git add -p` to sort them out into multiple commits. Note there are corresponding `-p` flags for things like git-restore and git-reset as well.

Let’s say you’ve checked out a new branch and done a bunch of work over the course of the last two hours. You’ve added a new feature. In doing that, you’ve also fixed four unrelated bugs, clarified the documentation for a method you needed to use, and rewritten another function to be more performant. You could push this all as six commits on one branch. PR reviewers will now have to figure out what parts are related…

This is the kind of example that I find insightful. I know I can do it with git and it's not hard. It's not fun, but it's not hard. So I will disagree with anyone who says that it's impossible with git.

But it is great to know that it is trivial in jj. That's a reason to try :-).

Re: Jujutsu for busy devs

#438
post #166

Earlier quoted context omitted.

I tend to `git add -p` and create different commits that I put on different branches if they are unrelated. Doesn't feel painful in git, but I'd like to see an example doing that with jj. Maybe I'll try.

jj lets you do this with changes that are related.

I can do it with changes that are related. But I understand that jj makes it trivial, which is not a life-changer but it's nice. Does that sound about right?

Re: Jujutsu for busy devs

#439
post #205

Earlier quoted context omitted.

Jj treats any public/pushed commits/branches as immutable by default.

How does it know that? Does it also work, when I clone or pull instead? Is that only enforced on the committer side? I mean git also doesn't force push by default, but that still means someone else can do that and I need to notice it.

There is a way to express which sets of revisions are immutable. This uses the revset feature which itself a whole amazing thing that hasn’t come up in the conversation yet. This is a mechanism by which you can concisely express and refer to entire sets of commits in your repo history, and lots of commands can operate on multiple revisions as easily as they can operate on one.

Just like git, it is only enforced by the tool itself on the client side. But it’s safer in practice because `git push -f` is a common habit when you’re working on a branch by yourself and it’s easy to fat-finger that in the wrong place. I have only ever had to use `jj --ignore-immutable` when explicitly doing repo surgery.

If you want branches like `main` to be truly immutable, you need to enforce that at the repo.

Re: Jujutsu for busy devs

#440
My NixOS repo checkout(s) are always cursed with unstaged changes, will jj help me cure this?

Sometimes I feel like "this shit is too bad to commit but it does the plumbing for the thing I'm working on right now" and it ends up untracked for weeks... This is just my personal ADHD pool of code but it gets really gnarly before I take care to dissect my unstaged changes into the repo.

Post reply on HN