logoalt Hacker News

ibejoeblast Tuesday at 11:12 PM3 repliesview on HN

A lot of the discussion focuses on differences from git and how it uses the git storage strategy under the hood. Honestly, I think you should just ignore all of that. Don't think about git. Here's a workflow that'll get you through your daily usage:

On a clean repo:

    $ jj
    The working copy has no changes.
    Working copy  (@) : abcdef a53ff9ba (empty) (no description set)
    Parent commit (@-): qrstuv 4bc1bf34 the last thing you did

Make some changes.

    $ jj # shows status (new, modified, deleted, moved, etc.)
If you're satisfied with your changes,

    $ jj commit -m "made changes"
    
Now `jj` is back to clean state. You don't need to do `jj new` to continue working linearly. Just make your next changes and commit. If you realize that you messed something up, fix it, then `jj squash` and it gets incorporated into that last commit.

You only `jj new -r lmnop` if you want to do some work based on the state of the codebase at revision lmnop, rather than the previous revision, which is a figurative branch. No need to manually create and name branches.

As for git history: just do `git log` to see what's actually going on. It's a clean history reflecting your `jj commit`s. You're not going to see all of the stuff the jj machinery does.


Replies

8n4vidtmkvmklast Wednesday at 1:37 AM

Sometimes i like to jj describe before writing any code. It helps with mental clarity what i intend on writing or helps if i have to run away mid coding session (description will show in log so i can find it again)

In this scenario I'd instead jj new at the end, after im finished and ready to move on to the next thing.

show 1 reply
busfahrerlast Wednesday at 10:47 AM

> Don't think about git.

You can also make the reverse point, only think about git:

In theory it's perfectly possible if you have to jj binary lying around somewhere, to not even use it as your git client, but to temporarily do a `jj git init --colocate`, do a complex restructuring of your repo across 3 branches, and then delete the .jj folder again :-)

Just to highlight the other end of the spectrum, jj is flexible like that

show 1 reply
skydhashlast Wednesday at 12:27 AM

If I really wanted that, I could create an alias like

  alias.save="!git add -A; git commit -m"
And then use

  $ git save "made changes"
show 1 reply