News for hackers. Stuff that matters.
Re:Jujutsu (jj), a Git compatible VCS by stouset on Sunday October 20, 2024 @12:03PM (#41896251)
And I remember everyone saying that git is confusing, that they get into states that they don’t understand and have to blow their local changes away, and that they have completely fucked their local copy more than once.

I’ll give you some concrete advantages:

1. Every time you run a `jj` command a snapshot of your local changes is made. I don’t know about you but often while I’m working on something experimental I have an idea for a slightly different approach, try it out, it doesn’t pan out, and I’m like fuck I wish I’d saved where I was an hour ago. git won’t do that for you but jj will.

2. The rebase workflow is dramatically better. Rebasing multiple commits with conflicts is excruciating. You have to fix it right here and right now but you’re in a weird repo state where you can’t easily to another commit and tweak it or look at the state of things at different times. It’s a pain in the ass and easy to get wrong. With jj there are no weird intermediate rebase states. Rebasing always succeeds and if there are conflicts you’re able to address them just by editing your changes as you would in any other situation.

3. I don’t have to make WIP commits or stash when switching between lines of work and I don’t have to remember to undo them when I come back. Your work is always committed. Stashing doesn’t need to exist any more and as a result I never have to worry about conflicts when unstashing. I never have to realize I’ve forgotten work that was stashed.

4. Named branches don’t follow you automatically. This is huge if you ever have to do some linear work that involves multiple PRs that have to be merged and deployed one by one by one. With git you have to make branch after branch after branch. And god help you if one of the earlier lines of work needs to be changed, now you have to rebase all the descendants. With jj all this work is linear. If you have to edit an earlier commit or insert a new commit inbetween two, it’s trivial.

I was a git expert. I’ve used it since before GitHub. I’ve written a barebones implementation of git from scratch. I was the guy everyone came to when they got stuck. I gave talks on git to my local language user meetup. And I will never need to touch it again.

Re:Jujutsu (jj), a Git compatible VCS by dsissitka on Sunday October 20, 2024 @12:19PM (#41896397)
> Every time you run a `jj` command a snapshot of your local changes is made.

I think that's going to be pretty divisive. For projects where your input is here, your output is there, and that's that I imagine it's fine. Getting people to implement one of the workarounds to avoid junking up the repo feels like a huge ask.

Re:Jujutsu (jj), a Git compatible VCS by steveklabnik on Sunday October 20, 2024 @12:31PM (#41896514)
I’ve found most modern codebase have good gitignore discipline, but it’s true that there are codebases that are not. There are also some tools that by default write files to the current directory.

The auto add feature is configurable these days though, so if you don’t like it, you can turn it off.

Re:Jujutsu (jj), a Git compatible VCS by eikenberry on Sunday October 20, 2024 @03:07PM (#41897717)
Auto-adding your changes to existing files sounds like a great feature, auto-adding any random files it finds in the project is a terrible one. I can't imagine why the author decided that was a good idea. Can someone explain the reasoning behind it? I can understand someone wanting it as some point so it makes a certain amount of sense to add as an option, but not as the default. Makes me wonder about what other bad decisions have gone into the project.
Re:Jujutsu (jj), a Git compatible VCS by steveklabnik on Sunday October 20, 2024 @03:10PM (#41897737)
It’s consistent and convenient.

I was skeptical until I tried it.

Re:Jujutsu (jj), a Git compatible VCS by eikenberry on Sunday October 20, 2024 @03:31PM (#41897882)
I'm a bit more than skeptical. Right now, for a project at work, looking at files in the repo (for testing, etc) I have 294 files untracked and 10 ignored. Using jj all but the ignored files would be committed to the repo and I'd have to something akin to git's filter-branch to clean them out again to avoid that bloat.

I guess I should ask... is that final step made super easy? That is does jj make it easy to completely remove all traces from the repo of those auto-added files (like filter-branch)?

Re:Jujutsu (jj), a Git compatible VCS by stouset on Sunday October 20, 2024 @04:52PM (#41898364)
You live with those files showing up as untracked because it was easy and convenient to do so with git.

If git auto-added them from the get go, you would have used a pattern in your personal or project gitignore to skip them, or you would have put them into an ignored tmpdir, or you would keep them on a separate branch if you intend to make them part of the repo. None of these steps would have felt painful or out of place. You see files you don’t intend to include in `jj status` and you’d do whatever is appropriate to exclude them.

I’m with Steve here. I too was skeptical, and it’s turned out to be a complete non-issue.

> and I'd have to something akin to git's filter-branch to clean them out again to avoid that bloat

It’s even more trivial than you might imagine. If you have a commit that added files you don’t want to include you `jj edit` that commit, remove them however is appropriate (rm, mv, add to gitignore, whatever), and… there is no step 3. Later commits are instantaneously and automatically rebased so as to not include those files. Tools like filter-branch are completely unnecessary.

Re:Jujutsu (jj), a Git compatible VCS by eikenberry on Sunday October 20, 2024 @05:39PM (#41898705)
Cool. You've convinced me. A small change in workflow + easy cleanup sounds like it addresses most of my concerns. Though if I were to adopt jj I'd still probably just turn off the feature at first until I saw where I could have used it in practice. I'm going to wait and see for a bit myself. I'm pretty comfortable with git.
Re:Jujutsu (jj), a Git compatible VCS by emacsen on Sunday October 20, 2024 @08:53PM (#41899766)
The way jj tracks changes isn't a feature you can turn off AFAIK. Maybe you can, but if you can, you shouldn't. This is fundamental to the jj internals and workflow.

As someone who also kept a lot of files in their repo that went untracked, it was a small adjustment. Add to my .gitignore, untrack the files, and done.

Re:Jujutsu (jj), a Git compatible VCS by stouset on Sunday October 20, 2024 @09:35PM (#41899949)
You can disable automatically adding untracked files to the repo, but you can't disable it from automatically incorporating changes to tracked files. I believe GP was talking about the former.
Re:Jujutsu (jj), a Git compatible VCS by eikenberry on Monday October 21, 2024 @12:04AM (#41900584)
Yes. It was specifically adding untracked files automatically.
Re:Jujutsu (jj), a Git compatible VCS by dsissitka on Sunday October 20, 2024 @01:12PM (#41896877)
> The auto add feature is configurable these days though, so if you don’t like it, you can turn it off.

That's one of the workarounds I had in mind. :)

This week I've had to work with CSVs, SQLite databases, and video in... six... different formats. Some goes in the repo, some doesn't.

It seems like my choices are:

- Disable it in the repo's .jj/repo/config.toml.

- Get people that don't like it to turn it off.

- Get people to do their exploratory coding in a gitignored directory.

It feels like any choice I make is going to be met with resistance.

Re:Jujutsu (jj), a Git compatible VCS by stouset on Sunday October 20, 2024 @01:22PM (#41896938)
You don’t have to convert your team to use jj. So there’s nobody to resist but yourself.

For me, writing temporary output to a gitignored tmp directory has been trivial. And I do exploratory coding in a separate branch. Just because it’s part of the repo doesn’t mean it needs to get pushed.

Re:Jujutsu (jj), a Git compatible VCS by dsissitka on Sunday October 20, 2024 @01:32PM (#41897024)
> You don’t have to convert your team to use jj. So there’s nobody to resist but yourself.

Currently, sure. I was more thinking about it as a possible Git successor.