News for hackers. Stuff that matters.
Re:Jujutsu for Busy Devs by landr0id on Monday July 21, 2025 @11:08PM (#44642875)
Honestly one of the biggest selling points of jujutsu for me is its `op log`. You can fuck up your repo in git and that's it -- you're screwed. Or you find some extreme magic on the internet that saves you.

With jj you just "jj op undo <operation_id_that_fucked_your_repo>" and you're fine.

Editing prior commits is also pretty easy, which in turn makes fixing merge conflicts pretty easy too.

Re:Jujutsu for Busy Devs by frizlab on Tuesday July 22, 2025 @12:04AM (#44643136)
Like… reflog?
Re:Jujutsu for Busy Devs by steveklabnik on Tuesday July 22, 2025 @12:39AM (#44643282)
Kinda!

jj has two kinds of these logs: the evolog and the op log.

The git reflog is based on, well, refs. Whenever a ref is updated, you get an entry. This log is per ref. That's HEAD, your branches, your tags, and your stash.

jj's evolog is sorta similar, but also different: it's a log, but per change (think commit in git). This means it is broader than per ref, as it includes not just commits that correspond to a ref, but all of them.

jj's oplog is a log per repository. This lets you do things like `jj undo`, which lets you get the entire repository, not just one ref or commit, back to the previous state, easily.

Re:Jujutsu for Busy Devs by 1718627440 on Tuesday July 22, 2025 @05:36AM (#44644902)
Yeah this doesn't make sense in git terms. A commit is immutable, it never changes so it doesn't have a history, it's just always there.
Re:Jujutsu for Busy Devs by KingMob on Tuesday July 22, 2025 @07:18AM (#44645510)
That's still true in jj, too.

But instead of commits, most of the time you're working with (the not greatly-named) "changes", which are a conceptual history of related commits. E.g., a single change ID points to the most recent commit in a list.

As long as you keep editing on a change, it keeps accumulating commits under the hood. When you move to another change (via `jj commit`, `jj new`, etc), all your new commits end up under a different change.

Re:Jujutsu for Busy Devs by 1718627440 on Tuesday July 22, 2025 @07:43AM (#44645674)
Ah, so when people here talk about changing commits they are actually talking about changing changes (nicely named, indeed)?

What happens when you merge or split changes with the change history? It sounds a bit like applying a VCS on top of a VCS.

Re:Jujutsu for Busy Devs by KingMob on Tuesday July 22, 2025 @11:10AM (#44647987)
Yeah, I love jj, but I'm not a fan of that naming. It threw me for a loop for the first couple months.

I'm not sure what happens, but I suspect a merge would create a single merge commit with the tips of the parents' histories, and then add new commits from there on.

A split is probably conceptually similar to making two new branches, except each of the new commits gets one of the branch tips. Really just guessing here, I have no idea if that's how it works, or if they share commits or not.

Re:Jujutsu for Busy Devs by steveklabnik on Tuesday July 22, 2025 @11:38AM (#44648508)
Yeah so people will be a bit loosey-goosey with the terminology. But all of these changes are immutable, that is, when you change a change, you’re generating a new commit. “A VCS on top of a VCS” isn’t a terrible way of thinking about it: imagine if every commit in your repo had its own history.

Merging is making a change that has more than one parent. You can then resolve any conflicts within that change.

Splitting a change into two will update one commit with one half and make a new change with the other half.

Re:Jujutsu for Busy Devs by 1718627440 on Tuesday July 22, 2025 @01:01PM (#44650017)
You can have merge conflicts, when you combine two commits (--amend in git terminology, not sure how it's called in jj)?
Re:Jujutsu for Busy Devs by steveklabnik on Tuesday July 22, 2025 @02:06PM (#44650888)
Oh, since you said 'merge' I thought you meant like git merge. Amending a commit works the same way as git. The difference is just that the oplog will have the full history, including before you amended, so you can roll back easily.
Re:Jujutsu for Busy Devs by 1718627440 on Wednesday July 23, 2025 @04:45AM (#44657019)
So the history of the second commit gets discarded?
Re:Jujutsu for Busy Devs by steveklabnik on Wednesday July 23, 2025 @09:10AM (#44658832)
Ah, I see what you're saying. I think so, the evolog ends up showing that stuff was squashed elsewhere, I believe.
Re:Jujutsu for Busy Devs by baq on Tuesday July 22, 2025 @04:34AM (#44644569)
no. reflog stores snapshots with descriptions; op log stores operations.