Hacker News new | ask | show | jobs
by aulin 53 days ago
Not familiar with jj and don't want to get into bike shedding, but how is describe supposed to be a good name for history rewrites?
4 comments

jj describe gives a name to a commit. In jj, everything rewrites the history, so there's no real point in calling it out in the command name since it's just the default behavior.
> In jj, everything rewrites the history (...)

Surely that isn't true, otherwise it would be completely unusable for auditing.

It's not true, in that sense. Commits in jj are basically the same as commits in git as far as mutability is concerned. But in jj you normally work with changes, rather than commits, and open changes are mutable (by altering which immutable commit they point to in the backing store). And there is effectively an append-only audit trail of these alterations (which is what makes `jj undo`/`jj redo` simple).

Some comments here are confusing the issue by saying ‘commit’ when they mean ‘change’ in the jj sense.

Re the grandparent comment, `jj describe` provides a change description, analogous to `git commit --amend --edit` in git terms.

it is true. some history is marked immutable by default; in git, everything is mutable by default and you have to add branch protection on the server side. (granted, you can change what is immutable in jj relatively easily, so you shouldn't ignore branch protection if you're using jj exclusively with a git repo, either.)
By default, if you push to main/master, it marks those commits as immutable (you can still force change). You can configure this to other branches.

But ... is it really that different from git? You can always rewrite history in git, correct?

describe is also the command you can use to edit the commit message of the change you're currently drafting. In jj there's no staging area, every modification to the working tree immediately gets integrated into the current commit. (This means if you have no diff in your working tree, you're actually on an empty commit.)
Not really familiar too, but jj has everything committed by default (no index, staging area, and uncommitted changes). You use ‘jj new’ to stop adding changes to the current commit.

‘jj describe’ lets you add a message to a commit as it’s not there by default.

in jj the history has mutable and immutable commits.