Hacker News new | ask | show | jobs
by aduwah 81 days ago
The only reason I have not defaulted to jj already is the inability to be messy with it. Easy to make mistakes without "git add"
5 comments

You're mistaken. I'm an absolute version control slob. JJ allows me to continue like that yet also collaborate with others. It tracks literally everything so I can not only split, squash, and rebase things to wherever they need to be, but can also rollback/restore/recover anything from either the repo-wide oplog or revision-specific evolog

You really ought to dive in deeper. jjui makes it all vastly simpler

You can be messy. The lack of an explicit staging area doesn't restrict that. `jj commit` gives the same mental model for "I want to commit 2 files from the 5 I've changed".
But you do have the op log, giving you a full copy of the log (incl. the contents of the workspace) at every operation, so you can get out of such mistakes with some finagling.

You can choose to have a workflow where you're never directly editing any commit to "gain back autonomy" of the working copy; and if you really want to, with some scripting, you can even emulate a staging area with a specially-formatted commit below the working copy commit.

https://docs.jj-vcs.dev/latest/config/#paths-to-automaticall...

Or treat the head commit as just a scratch space and the one before it as equivalent to git staged index, and use `jj squash PATH`, `jj squash -i` etc to "stage" things, or directly `jj commit -m "foo" PATHS` (or -i) to make a new commit with just wanted changed. This is what I do.

You can turn off the auto-tracking, and add your files manually.